4 ms·
False; the syntax before expanding macros is an AST, so is the one after. It's an AST-AST transformation. In context, this is about producing an AST in a "base
by kd0amg 9y ago
False; the syntax before expanding macros is an AST, so is the one after. It's an AST-AST transformation.
In context, this is about producing an AST in a "base" language without all the language extensions the actual user program uses.
- kazinator 9y agoIn context, the article says exactly this What’s this intermediate syntax tree? It’s an almost entirely superficial understanding of your program: it basically does paren-matching to create a tree representing the surface nesting structure of the text. This is nowhere near an AST, but it’s just enough for the macro expansion system to do its job.. That is completely false. If the code happens not to use any macros, they are the same. One is exactly as "superficial" as the other. Macros write code in the same language that the human user; they use other macros and even recursively themselves sometimes.
- kd0amg 9y agoWhat systems have you been using where reading involves a more than superficial understanding of the program? Normally, a reader doesn't even know how many arguments ought to be given to each function or syntactic form, nor does it know the difference between macro invocation and a function call. There is no need for the reader to know what the syntactic forms in the base or extended language are. The value of s-expressions (or any notation that explicitly encodes the tree shape) is that the reader can function without that knowledge.