Recursive Descent Parser

后端 未结 5 1665
南笙
南笙 2020-12-23 15:23

The book \'Modern Compiler Design\' is the nice book about compilers. In its source code something that is annoying me is AST or Abstract Syntax Tree. Suppose we want to wri

5条回答
  •  滥情空心
    2020-12-23 15:51

    You can create an AST with Dijkstra's Shunting-yard algorithm.

    At some point you will have the whole expression or AST in memory though, unless you calculate immediate results while parsing. This works with (sub-)expressions containing only literals or compile time constants, but not with any variables calculated at runtime.

提交回复
热议问题