I think that the PHP port was started but has not been maintained. I could
be wrong on that, and maybe the original author would like to chip in on it?



Jim





*From:* antlr-dev-boun...@antlr.org [mailto:antlr-dev-boun...@antlr.org] *On
Behalf Of *Jonathan Bond-Caron
*Sent:* Wednesday, March 23, 2011 8:21 AM
*To:* antlr-dev@antlr.org
*Subject:* [antlr-dev] Tests cases for runtime



Hi I’m new to the list,



I’ve created a custom test suite for the php runtime:

http://code.google.com/p/antlrphpruntime/



I’d like to test some improvements but I’m having a hard time finding the
tests I should be running.



For example:

https://github.com/antlr/antlr/blob/master/runtime/Python/tests/t022scopes.g



/* recursive rule scopes, access with negative index */



f returns [res]

scope {

    a

}

@after {

    $res = $f::a;

}

    : NUM { $f[-2]::a = int($NUM.text); }

    | '{' f '}'

    ;



It seems that python and java have different implementations for a “negative
index”:



JAVA

scopeSetAttributeRef(scope,attr,expr,index,negIndex) ::= <<

<if(negIndex)>

((<scope>_scope)<scope>_stack.elementAt(<scope>_stack.size()-<negIndex>-1)).<attr.name>
=<expr>;

<else>



PYTHON

scopeSetAttributeRef(scope,attr,expr,index,negIndex) ::= <<

<if(negIndex)>

<!FIXME: this seems not to be used by ActionTranslator...!>

self.<scope>_stack[-<negIndex>].<attr.name> = <expr>

<else>



Questions:

-          Is there a test suite (i.e. for java) I should be looking at?

-          Any documentation/more examples on recursive rules scope and what
this test does? What is special about negIndex?



Thanks J
_______________________________________________
antlr-dev mailing list
antlr-dev@antlr.org
http://www.antlr.org/mailman/listinfo/antlr-dev

Reply via email to