[antlr-interest] Step-by-Step parsing

Harald Mueller harald_m_mueller at gmx.de
Sat Dec 8 03:04:47 PST 2007


Hi - 

this is what is called "(computation of) follow sets" in parsing terminology; and ANTLR internally certainly does this - however, as far as I(!) know and have seen in the generated code, not for public use, but for its internal code generation only; with ANTLR3's LL(*) analysis, I would guess that at times it does not even compute good(?) old "follow sets", but "follow graphs", which are not that useful for you.

I (I!) would start that project from scratch - and restrict myself to a simple grammar definition syntax, not ANTLR's full fledged machinery - with e.g. its syntactic predicates, multiple ways to specify tokens (names and strings), additional syntax for AST generation(^) and executable code(nested {...}s) etc. Only when that project starts getting "large," you would/could contribute to ANTLR to make follow sets visible.

Otherwise, you need an "ANTLR internals guru" (e.g. Terence!) who'd show you around the guts of ANTLRs to make the follow-set-interface publicly useable.

Regards
Harald

-------- Original-Nachricht --------
> Datum: Fri, 7 Dec 2007 15:09:26 +0000
> Von: "Pablo H" <paox75 at gmail.com>
> An: antlr-interest at antlr.org
> Betreff: [antlr-interest] Step-by-Step parsing

> Hi everybody,
> 
> I am newbie in parser generator tools. I have just downloaded antlr and I
> have made some basic examples. I would like to know how to use antlr for
> parsing a grammar step-by-step. My goal is to develop a program that,
> given
> that a particular state of the parsing processing, it returns the list of
> candidate tokens. For example, given that the following grammar:
> 
> S : 'a' A 'c' B ;
> A : ('b')* | 'c' ;
> B : ('d')+ ;
> 
> if the parser has already recognized "abb", calling the function
> getCandidateList() will return "b c".
> 
> May you provide me some hints?
> 
> Thank very much in advance

-- 
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten 
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser


More information about the antlr-interest mailing list