When I developed the LISP interpreter, I somewhat struggled with handling edge cases correctly. You might be wondering why I decided against writing everything for the interpreter myself. Turns out that Super Bowl fifty won’t be marketed in the tradition of previous championships as “Super Bowl L” but rather as “Super Bowl 50.” Oh well! I thought what with the NFL championship right around the corner that this might be relevant. Rather than a programming language, for this project we’ll interpret Roman numerals to decimals. Remember all the hard work we did to parse LISP code before we could interpret it? This time we’ll let ANTLR write that code for us we just need to provide an implementation of a tree visitor to traverse the abstract syntax tree that the ANTLR parser gives us. ANTLR, or Another Tool For Language Recognition, takes as input a grammar, or language specification describing the language one would like to interpret, and generates as output source code for a recognizer for that language. I recently decided to take a look at learning ANTLR for the purposes of building an interpreter similar to the one we developed not too long ago. Gjdanis About Archive Feed Writing interpreters with ANTLR
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |