Recently interested in the compiler, intends to write a Python interpreter in accordance with the idea of the book, but too much detail and the compilation process is not aware of the slow progress. Just now think of the SICP in the past to see the implementation of the calculator, think about whether you can use a simple arithmetic to get started, so with this calculator. Due to the author's level problem, there are many loopholes in the implementation method and code design. Write the text is also to be able to organize ideas, check gaps, at the same time or to meet the same problem of children's shoes to provide a thought bar. Progress: This calculator is now implemented into the syntax tree stage, error handling has not been understood. Code schema:
-
- Scanner: Using the state machine, refer to the Blue Big article http://frozengene.github.io/unfortunately did not finish
- Parser: Using recursive descent
- Reference to the Vczh of the http://www.cnblogs.com/geniusvczh/specific article unexpectedly can not find.
- and assembling the head of the http://www.cnblogs.com/Ninputer/archive/2011/06/21/2085527.html wish to recover soon
- Experssion: Simply traverse the tree to get the calculation results
- GitHub Address: Https://github.com/ninovt9/NINO_CALCULATOR.git
Next article first write scanner
Homemade Calculators (0)