2 ms·
In lisp/scheme, you write the abstract syntax tree, skipping the parse step entirely.
by marktangotango 10y ago
In lisp/scheme, you write the abstract syntax tree, skipping the parse step entirely.
- mschaef 10y ago> skipping the parse step entirely. Not strictly true... there is still parsing involved in reading Lisp data structures from a character stream. (It's just much less involved than in traditional infix languages.) The way to think of it is this: 1) Lisp has a much more comprehensive (and read/write) syntax for its core data structures. 2) Lisp, the language, is defined in terms of those data structures rather than in terms of character sequences and grammar productions.
- marktangotango 10y agoI think of it as serialing/deserializins the AST to text :)
- mschaef 10y agoI can see that, but it doesn't feel quite right. The tree you get directly from deserialized source text is still a bit more fine grained than I'd expect a true AST to be. To see what I mean, consider this: (if condition 1 2 3) This expression can be deserialized into a Lisp data structure, but it still contains a syntax error, and I don't think a true AST would be able to represent that syntax error.