[antlr-interest] Possible solution for Problems 1 and 3 (per-token and per-tokenref AST mappings)

Daniel Gackle gackle at shaw.ca
Sat Jan 18 00:12:06 PST 2003


> That's all for now.

Uh, I lied, sorry :). I got one more thing for you.  The workaround I added
to ASTFactory.cs was all wrong. It made things compile, but not run.   I
think I understand a bit better now what the codegen is trying to do with
lexer tokens that get mapped to hetero ASTs.  It is trying to call a method
similar to create(Token tok) but override the AST node type at the same
time.  In other words, it wants something like this in ASTFactory.cs:

/// <summary>Added by dg</summary>
public virtual AST create(Token tok, string ASTNodeTypeName)
{
	AST newNode = createFromNodeName(ASTNodeTypeName);
	newNode.initialize(tok);
	return newNode;
}

Deleting my mistaken fix, and adding this, actually solves not only Problem
3 but Problem 1 as well.  Cool!  But Problem 2, the absence of type mappings
for non-lexer (imaginary) tokens, remains.

Daniel



 

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



More information about the antlr-interest mailing list