[svlug] Some pretty serious parsing

Karen Shaeffer shaeffer at neuralscape.com
Sun Nov 15 07:34:58 PST 2015

On Sat, Nov 14, 2015 at 09:12:02PM +0000, Karen Shaeffer wrote:
> If your formal grammar is context-sensitive, then one simplifying strategy is
> to break it into two or more context-free parsers, each of which could be
> auto-generated for you by GNU bison for example. The idea is analogous to how
> HTML embeds javascript and php and other languages inline. And so when your top
> level parser finds a specific set of tokens, everything in there is parsed by a
> different context-free parser.

After giving this statement some thought, I don't believe it is generally true.

The proper process is to specify your language with a set of formal grammar rules
to concisely characterize it. If there is any doubt about whether it is a type-3
or type-2 or type-1 grammar, you could input the set of rules into GNU bison. I
have never used bison, but I believe it will emit an error, if it is a type-1
grammar. Otherwise it will output a working parser for a type-2 or type-3

Adapt and thrive,
Karen Shaeffer                 Be aware: If you see an obstacle in your path,
Neuralscape Services           that obstacle is your path.        Zen proverb

More information about the svlug mailing list