Compilers - Am I writing one?

Hans Fugal hans at
Mon Jun 30 10:17:04 MDT 2008

Jacob Fugal wrote:
> On Mon, Jun 30, 2008 at 9:58 AM, Michael Torrie <torriem at> wrote:
>> Hans Fugal wrote:
>>> In which way? They take ascii art as input? I had no trouble with the
>>> syntax diagrams in 431, but I found them hard to work with. I couldn't
>>> send one by email easily. I had to have a PDF viewer and scan through
>>> dozens of pages of diagrams (we know how much fun that can be) or lug
>>> the large book (which I printed out at Kinkos) around. I decided to
>>> write my own parser generator, and so I had to enter all those diagrams
>>> into BNF format (which seemed like a reasonable machine-readable
>>> choice), and while tedious I don't remember it being difficult. In fact,
>>> I seem to remember very quickly finding a few patterns, and converting
>>> to BNF was primarily a rote exercise.
>> Good point.  I presume from a casual googling that ANTLR must have some
>> notation that allows one to easily define a syntax diagram using some
>> notation.  I would guess (and that's all it is) that the syntax would be
>> similar to how PyParsing defines a grammar.  Easy ways to say "one or
>> more" or "zero or more," for example.  Given that format it is just as
>> clear and easy to run through a parser generator as BNF.
>>From my understanding, this is one of the major differences between
> BNF and EBNF. EBNF allows specifying right repetition ala:
>   expr -> term { addop term }
>   addop -> "+" | "-"
> and optionality ala:
>   if-stmt -> "if" expr "then" stmt-block [ "else" stmt-block ]
> These constructions covert really easily into both a syntax diagram
> and a recursive descent implementation. Maybe I'm misremembering,
> though.
> Jacob Fugal

Good point, and I was using EBNF not straight BNF (which only has 
theoretical value, IMHO).

Hans Fugal ;

There's nothing remarkable about it. All one has to do is hit the
right keys at the right time and the instrument plays itself.
     -- Johann Sebastian Bach

More information about the PLUG mailing list