[stringtemplate-interest] no "..." pass through argument for v4?

Sam Harwell sharwell at pixelminegames.com
Wed Jan 12 11:50:33 PST 2011


I thought the '...' meant assign all remaining parameters by name to the
arguments in the current scope. For example, for the following definition of
ruleA, each definition of ruleB performs exactly the same.

ruleA(x,y,z) ::= ""

ruleB(x,y,z) ::= "ruleA(x=x,y=y,z=z)"
ruleB(x,y,z) ::= "ruleA(x=x,...)"
ruleB(x,y,z) ::= "ruleA(...)"

If that's really the case, then the '...' shouldn't be a performance
problem. Perhaps I'm missing something about the behavior of the '...'?

Sam

-----Original Message-----
From: stringtemplate-interest-bounces at antlr.org
[mailto:stringtemplate-interest-bounces at antlr.org] On Behalf Of Terence Parr
Sent: Wednesday, December 22, 2010 2:26 PM
To: stringtemplate-interest at antlr.org List
Subject: [stringtemplate-interest] no "..." pass through argument for v4?

In v3 we have a ... arg that lets us see dynamically inherited values
through arguments like this:

/** i+=INT in lexer */
lexerRuleRefAndListLabel(rule,label,args,elementIndex,scope) ::= <<
<lexerRuleRef(...)> <listLabel(elem=label,...)>
>>

it's just bein lazy, not passing arguments along.  It has a big peformance
hit so i think i'll drop for v4.  

Consider

f(a) ::= "<name>_<a>"

arg 'a' is clearly immediately available w/o looking up the chain of
enclosing templates so it should be a fast array lookup.  name is clearly
not defined as arg and so slower lookup is needed.  If we allow "<f(...)>"
the assumption that 'a' is an arg is no longer true.

Ter
_______________________________________________
stringtemplate-interest mailing list
stringtemplate-interest at antlr.org
http://www.antlr.org/mailman/listinfo/stringtemplate-interest



More information about the stringtemplate-interest mailing list