[antlr-interest] a couple of questions regarding antlr 2.7.1 reference manual

Terence Parr parrt at jguru.com
Mon Dec 16 14:00:37 PST 2002


On Monday, December 16, 2002, at 12:06  PM, davidjpenton2002 
<nwestreb at arrowsash.com> wrote:
> First, what does "hoisting" mean, e.g. "a predicate that would be
> hoisted into the prediction expression" etc. (metalang.html p.15).
> Is this a term of art in compiler generation, or have I missed the
> definition of this term in the manual somewhere? Not uderstanding
> what it means is impeding my grasp of semantic predicates.

http://www.jguru.com/faq/view.jsp?EID=25327

It means to test expression in prediction expression, but antlr only 
hoists a distance of 0 at the moment; meaning expression is only 
hoisted into enclosing expression--not out of the rule for example.

>
> Second, I am a little baffled about constructs such as the following
> in semantic actions, again from p.15 of the metalanguage doc (pdf
> version):
>
> stat: {isTypeName(LT(1))}? ...etc.
>
> What I don't understand is, what are things like LT(1) and LA(1)? It

LA(1) next token of lookahead...LT(1) next Token objct of lookahead.

> appears that they are have something to do with lookahead, but at the
> point I encounter them in the manual, it is not clear if they are
> made available by antlr, or are user-defined things, etc.

ANTLR provides them.  Take a look at the Parser.java file etc... and 
you'll see these definitions.

>
> Thanks for bearing with me as I struggle my way from newbie to
> seasoned antlr user.  I have a fair bit of experience with yacc, cup,
> etc. but not with antlr.

Welcome :)

Terence
--
Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org
Lecturer in Comp. Sci., University of San Francisco


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list