It is time to start describing the grammar for ASPL. We start with basic arithmetic expressions that support adding, subtracting, multiplying, and dividing positive numbers only. Later we will add negative numbers and grouping as well. This will be the base of our parser.
Last time, we finished the lexer. We can now create tokens from the source code. Our understanding about the meaning of the source code grows, but it isn’t complete yet. It is time to take it to the next level by parsing the tokens and creating the abstract syntax tree.
We have our minimalistic framework in place, we can now start writing our compiler. The first step in any compiler is lexing. The lexer takes the source code as input and outputs tokens that makes up the grammar of the given language.
Let’s write our lexer for ASPL!