From: hipster Date: 2001-10-30T21:30:03+09:00 Subject: [ruby-talk:23836] Re: GUI for Ruby On Tue, 30 Oct 2001 20:28:54 +0900, Robert Feldt wrote: > On Tue, 30 Oct 2001, hipster wrote: > > > JFYI: ANTLR should be able to handle any type 0-3 grammar using > > semantic and syntactic predicates, multiple parsers/lexers, AST > > transformations, &c. Still extra work, but no need to rewrite the > > grammar. > > > Maybe we are misunderstanding each other but I would consider this extra > work a rewrite of the grammar since when I have a grammar in my head there > is no need for syntactic predicates, multiple lexers etc. If you need it > to describe the grammar then the tool adds unnecessary things. I'm not > saying its evil (since you would typically get better performance by > describing things in more detail) just that it adds things so its no > simpler. I basically agree with you. I quite like the ability though to be able to leave the grammar untouched and make it acceptable for the parser generator using the aforementioned specifics. (The ability to have Emacs antlr-mode hide all predicates+actions, leaving me the bare, unaltered grammar, is especially pleasing.) Whether I'd go for a rewrite or adding predicates depends on the grammar at hand. > The only situation were you *HAVE* to add things to your grammar > is if it is ambigous and you want the parser to return only one tree. All > other situations are tool-specifics. Agreed. > The big drawback with GLR and Early parsing is that the algorithmic > complexity is higher for *some* grammars, ie. parsing can take *long* > time. However, in practice these grammars are rare. Another drawback is > that we have less experience with these algorithms so there are still > implementation issues etc. You might want to check out the article "Why > Bison is becoming extinct" at > http://www.acm.org/crossroads/xrds7-5/bison.html for some info > relating to this. However, he doesn't mention ANTLR. If you want to check > out mature GLR and Early parser gens you might take a look at Accent and > ASF+SDF. Sorry if this is already familiar to you. These are new to me, thanks for the pointer. > I'm unfamiliar with the term "type 0-3" grammar. How does it relate to > Context-freeness an LL(k), LALR(k) etc? Sorry for my terse taxonomy there -- they're just the 4 grammar classes: type 0: irregular 1: context sensitive 2: context free 3: regular > Oh, and ANTLR seems to be a really powerful tool. And its a plus you get > parser that can be read by a human (compared to table-based ones). I > especially like the rewrite stuff in there and how you can use the same > formalism both for lexing and parsing. Cool stuff. Yes! :) regards, Michel