4 ms·
I don't think creation of a syntax tree is always explicit; I have read C compiler source codes that use one pass with back-patching and the usable representati
by cardiffspaceman 6y ago
I don't think creation of a syntax tree is always explicit; I have read C compiler source codes that use one pass with back-patching and the usable representation is bytecode or machine code. One could reckon that the AST is implicit during code generation as functions call each other to generate the code. A valid JS interpreter could just do what the statements say using dictionaries for each scope, linked together to allow levels of scope with the right semantics.
- jcranmer 6y agoIt's worth noting that the scoping of names in C language is designed to be solvable in one pass: you can't use a function before it's declared. Most newer languages instead require a full pass to discover all the available names, to allow functions to not require a separate declaration before all uses.
- deleted 6y ago[deleted]