[<<][compsci][>>][..]
Tue Nov 1 16:14:19 EDT 2011

Ad-hoc syntax design

There are two ways to look at languages:

  - Properties of the grammar.

  - Properties of the parser.

For an ad-hoc language the latter is far more useful to focus on than
the former.  It's cool to be able to derive parsers from grammars
automatically, but the restrictions that are necessary to make this
work well require some getting used to.

On the other hand, if you focus on keeping the parser simple so it can
be done by hand using recursive descent, there are a couple of ways to
make language design decisions that keep the parser simple.  In
general this is: "avoid backtracking".

Usually, some amount of backtracking is necessary, but it's probably
best to keep it local and bounded such that it can be implemented by a
simple linear succession of tries that don't need large context store,
i.e read something that's finite size and stick it in a buffer, then
try to parse it in any of a couple of ways.




[Reply][About]
[<<][compsci][>>][..]