Lexer? I hardly know 'er!

It's time to start writing a program that can understand the assembly code that I wrote about last time. That way, I can stop hard-coding the program into a C file, and instead just load a Carp file!

Let me backtrack. There are a few parts of the program that reads the assembly code. They are:

  1. Lexer
  2. Parser
  3. Interpreter/Compiler

Their respective jobs are:

  1. Read the raw code and separate it into tokens (keywords, values, etc)
  2. Read the list of tokens and separate them into groups (function calls, arguments, etc)
  3. Do what the program says / write the machine code of the program to a file

I've never written a lexer before. I've never written a parser before. But I have written a horrific interpreter/compiler consisting almost entirely of if/else statements. Don't do what I did... but if you want to look at the mess (still public because I have no shame), check it out here.

So far, I have written some functions that:

  1. Separate an array of characters (read from a file) into a linked list
  2. Do type-checks on characters
  3. Clean up all of the data

Aaaaaand now I just need to write the actual hard parts. Fantastic. Coming soon! Hopefully.