CoreDump: A Tutorial

  1. Design the language as a subset of ANSI C, and remove features from ANSI C grammar which is BNF.
  2. Use a parser generator to generate the abstract syntax tree, parse tree and convert to JSON.
  3. Use RxJava to convert JSON to a data stream.
  4. Write a map to iterate over the stream, add an observer and convert tokens to MIPS machine code.
  5. We do not describe optimization, loop unrolling etc.

JavaCC | The most popular parser generator for use with Java …

Hermes is another generator that can generate java and you can add the lexer(), parser() and eat() as native Java in the grammar.

scottfrazer/hermes: Python LL(1) Parser Generator … — GitHub

Remember to hand-code the generated code, to high-quality compiler code, an art that takes decades to learn, help is available from AWS Code Guru, an AI-based code refactoring tool.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store