[antlr-interest] wildcard for tree node: x=EOA ?

Christian Boitet Christian.Boitet at imag.fr
Sun Mar 18 07:33:21 PDT 2012

Hello,						18/3/12

we got no answer to the question below sent on 22/2/2012.

That problem has forced us to stay behind with 
ANTLR 3.1, but we certainly should move to ANTRL 
3.4 asap.

It should be easy to keep compatibility with what 
existed before, namely that, in a tree 
expression, the first element, which must be a 
node, is treated as a node if it is a "wildcard" 

Example: ^(x=., y=., z=.)

$x should be a node and $y, $z should be trees.

With ANTLR 3.4, we get an error message on $x:

	"Wildcard invalid as root; wildcard can itself be a tree".

Jean-Claude tried a solution (see below), but it did not work.

In some tree-rewriting systems, like the 
Q-systems of Colmerauer, there are 3 parameter 
A*n  for a node
I*n  for a single tree (non empty)
U*n  for a forest (possibly empty list of trees)

Thanks in advance,


Hello,    -- 22/2/12 --

Sam Harwell (26 novembre 2008) proposed the 
correction for the generic wildcard node:
1. Is it implemented in antlr 3.4 for C ?    -- "it" = "that correction"
2. Is EOA the generic type of a node ?       -- it seems NOT
3. Can I write:

// Impression XML:
// ***************
@init{ int nond=0; }
	appxml[1, &nond]

appxml[int indent, int* pnond]:
	^( x=EOA
			{ imprimerNoeud2XML(indent, debut, $x, pnond); }
		appxml[indent+1, pnond]+
			{ imprimerNoeud2XML(indent, fin, $x, pnond); }
			{ imprimerNoeud2XML(indent, feuille, $y, pnond); }

I am upgrading from antlr 3.1 to 3.4 and until 
now I used the dot as the generic node (  x=. and 
y=. in the above example ).
Now I get the error "Wildcard invalid as root; wildcard can itself be a tree".

Thanks a lot in advance

Jean-Claude Durand

LIG, équipe GETALP
385, rue de la Bibliothèque
BP 53
38041 Grenoble cedex 9

Jean-Claude.Durand at imag.fr
tél: +33 (0)4 76 51 43 81
fax: +33 (0)4 76 63 56 86

List: http://www.antlr.org/mailman/listinfo/antlr-interest

More information about the antlr-interest mailing list