Hacker News new | ask | show | jobs
by samsaga2 1191 days ago
If the languages are similar:

  1. Tokenize
  2. Build AST tree
  3. Emit target code from the AST tree
If they are very different:

  1. Tokenize
  2. Build AST tree
  3. Create a simple intermediate language from the AST tree
  4. Emit target code from the intermediate language
It is the same as building a whole compiler, but without the optimization/register allocator passes.