Or: how to write the easy part of a compiler
This post will cover this stackoverflow question on how to translate an expression to a C-like language by user2516265. The other answers suggested regexes or treating it as Perl code *shudder*. This post aims to cover:
- parsing with Marpa::R2,
- AST manipulation,
- optimization passes,
- compilation, and
- Perl OO.
It won't cover parser theory etc. or provide a copy&paste-ready solution. The estimated size of the final code will be around