[antlr-interest] A few suggestions re. ANTLRWorks

Jim Idle jimi at temporal-wave.com
Mon Feb 4 20:45:29 PST 2008



> -----Original Message-----
> From: Olivier Lefevre [mailto:lefevrol at yahoo.com]
> Sent: Monday, February 04, 2008 4:48 PM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] A few suggestions re. ANTLRWorks
> 
> When debugging, the first thing ANTLRWorks does is pop up a file save
> dialog requesting a file name where to save the grammar. Since it is 
an
> error to save a grammar xxx in any other file than xxx.g 


Or xxx.g3pl, or g3t or any other suffix.

> but ANTLRWorks
> will let you do that (and later put a wavy underline under the grammar
> name) it should not pop up a file dialog but a directory dialog and
> then automatically give the file the only valid name under that
> directory: that would be more robust.

Which is a fair point that it perhaps should at least pre-fill the file 
name.

> Next comes the Input Text dialog. The Start Rule was set to a
> (seemingly randomly chosen) rule in the grammar describing a single
> line, so that the debugger terminated after the first line of input.
> This drove me _nuts_ and it took me a while to realize (by chance) 
what
> was going on.
> It seems to me that the only sensible default for the Start Rule is 
the
> topmost rule of the grammar, whatever that is, and that it should be
> set to _that_ the first time.

There is no real reason that the first rule is likely to be more correct 
as a target than any other. Choose your rule and it remembers your 
choice. There are many grammars where the 'start' rule depends on what 
you are testing. It might be more likely than not that the first rule 
listed is the start rule, but more likely that a rule ending with the 
EOF token is the start rule.

> Third, given how much aggravation spaces, newlines etc can cause, it
> would be nice if ANTLRWorks, in the input window, could highlight 
these
> characters, e.g., after the fashion of emacs blank-mode-on. I have
> attached an example to show what I mean.

Whitespace has no meaning in ANTLR grammars. In lexer rules, it can only 
assume that what you put in there is what you meant. You are confusing 
something that you personally find confusing/annoying, but after a while 
I don't think people in general do (I am prepared to be told otherwise 
;-).) So, while I see your point about highlighting 'whitespace', I am 
not sure it is generally useful. What you call whitespace has no real 
meaning without context.

Jim



More information about the antlr-interest mailing list