I am trying to create a compiler and lexical analysis. Let's say I take the simple "Hello World!" program as a string file and extract tokens from it. What is the best way to store these tokens? In one data structure or in two or more data structures depending on the type of token?
You need to build a parse tree, not just a list of tokens. I suggest that you continue reading on this subject before you start coding,
Actually, you do not want to store all tokens, period.
, , . , , . node AST. , , , , , , .
, , , - AST ? , , / AST. , .
AST . . , node . YMMV.
Source: https://habr.com/ru/post/1524251/More articles:PDF Print Programmatically - androidWhat is the C # language property that makes reflection possible? - reflectionto avoid asynchrony of the update fragment when changing the screen orientation - androidWhich package should I use to connect R with MongoDB? - rHow to use @RenderPage to enable inline CSS content - MVC Razor - htmlHow to center text in bootstrap 3 progress indicator? - htmlstty: standard input: invalid argument when using pdsh or ssh - linuxAFNetworking NSURLErrorDomain -1005 - postJava - Happens Before - Volatile - javajava.net.MalformedURLException - while parsing an XML StAX file - javaAll Articles