Hacker News new | ask | show | jobs
by marktangotango 3385 days ago
In lisp/scheme, you write the abstract syntax tree, skipping the parse step entirely.
1 comments

> 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.

I think of it as serialing/deserializins the AST to text :)
I 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.