Code Monkey home page Code Monkey logo

pboyer / antlr4 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from antlr/antlr4

26.0 26.0 1.0 56.93 MB

ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files.

Home Page: http://antlr.org

License: Other

Java 33.94% PowerShell 0.07% C# 13.35% ANTLR 1.98% JavaScript 5.06% Python 16.12% Batchfile 0.03% C 0.11% GAP 1.33% Go 4.35% Shell 0.11% CMake 0.22% C++ 11.81% Objective-C++ 0.33% Objective-C 0.01% Makefile 0.02% Swift 11.11% HTML 0.03%

antlr4's People

Contributors

abego avatar bdkearns avatar bhamiltoncx avatar brwml avatar calaura avatar cgudrian avatar davesisson avatar dtymon avatar ericvergnaud avatar ewanmellor avatar hanjoes avatar janyou avatar jcbrinfo avatar kvanttt avatar lecode-official avatar lygav avatar marcohu avatar michaelpj avatar mike-lischke avatar nttdatahenriksorensen avatar parrt avatar pboyer avatar redtailedhawk avatar renatahodovan avatar sebkur avatar sharwell avatar thomasb81 avatar willfaught avatar wjkohnen avatar xied75 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

millergarym

antlr4's Issues

TestFailure: testReturnValueAndActionsList1_4

testReturnValueAndActionsList1_4(org.antlr.v4.test.runtime.go.TestLeftRecursion)  Time elapsed: 2.195 sec  <<< FAILURE!
org.junit.ComparisonFailure: expected:<...* (expr b)) , (expr [c) , (expr (expr x) * (expr y)) >> (expr r)]) <EOF>)
> but was:<...* (expr b)) , (expr [(expr c) , (expr (expr (expr x) * (expr y)) >> (expr r))) <EOF>]) <EOF>)
>
    at org.junit.Assert.assertEquals(Assert.java:115)
    at org.junit.Assert.assertEquals(Assert.java:144)
    at org.antlr.v4.test.runtime.go.TestLeftRecursion.testReturnValueAndActionsList1_4(TestLeftRecursion.java:2134)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:622)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
    at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:74)

Typo in prediction_context.go

File: prediction_context.go
Line: 386
error:
bc, ok2 := a.(*BaseSingletonPredictionContext)
correct:
bc, ok2 := b.(*BaseSingletonPredictionContext)
One test less to go; I think it is
testAmbiguityNoLoop

TestFailure: testLoopsSimulateTailRecursion

testLoopsSimulateTailRecursion(org.antlr.v4.test.runtime.go.TestFullContextParsing)  Time elapsed: 2.325 sec  <<< FAILURE!
java.lang.AssertionError: expected:<line 1:3 reportAttemptingFullContext d=3 (expr_primary), input='a(i)'
line 1:7 reportAmbiguity d=3 (expr_primary): ambigAlts={2, 3}, input='a(i)<-x'
> but was:<null>
    at org.junit.Assert.fail(Assert.java:88)
    at org.junit.Assert.failNotEquals(Assert.java:743)
    at org.junit.Assert.assertEquals(Assert.java:118)
    at org.junit.Assert.assertEquals(Assert.java:144)
    at org.antlr.v4.test.runtime.go.TestFullContextParsing.testLoopsSimulateTailRecursion(TestFullContextParsing.java:412)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:622)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
    at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:74)

"Hand-written" generated code

What do you think about generating code that, to all appearances, was written by hand? I think more programmers would be willing to use generated code if it felt "cleaner". This question came to mind when I came across the fileHeader template:

fileHeader(grammarFileName, ANTLRVersion) ::= <<
// Generated from <grammarFileName; format="java-escape"> by ANTLR <ANTLRVersion>
>>

TestParseTrees is ok

Java Array to String works differently from Go Array to String (in fmt.Println).
So TestTokenAndRuleContextString is not a failure
Go creates [a b c] whereas java [a, b, c] Change the assert to

assertEquals(_
            "[a s]\n" +
            "(a x)\n", _found);



antlr4gen4go tool name change proposal, install, setup and usage

Your fork of antlr to generate golang code is awesome. Thank you.

I propose you rename it to distinguish it from the original antlr tool and and clarify its distinct intended purpose.

On Debian, you'll need to install a few things
apt-get install openjdk-8-jdk
apt-get install maven
go get github.com/pboyer/antlr4
cd /usr/local/lib
curl -O http://www.stringtemplate.org/download/ST-4.0.8.jar
export CLASSPATH=".:/usr/local/lib/ST-4.0.8.jar:$CLASSPATH"

If you aren't accustomed to maven, it's important to specify where to invoke the command. In this case, it's important to invoke the mvn install command from the top directory of pboyer's antlr4:
cd $GOPATH/src/github.com/pboyer/antlr4/
mvn install
NOTE: the above built, installed and tested antlr4 gen4go. It also left the residual tests in /tmp/. I would recommend you go there to peruse the Test.go files to inspire you for main drivers for golang that utilize the parsers.

Initialize some other environment variables pointing to the newly built antlr4 gen4go:
export CLASSPATH=".:$GOPATH/src/github.com/pboyer/antlr4/tool/target/antlr4-4.5.2-SNAPSHOT.jar:$CLASSPATH"
alias antlr='java -jar $GOPATH/src/github.com/pboyer/antlr4/tool/target/antlr4-4.5.2-SNAPSHOT.jar'

FYI WITHIN THIS DIRECTORY:
$GOPATH/src/github.com/pboyer/antlr4/runtime-testsuite/test/org/antlr/v4/test/runtime/go/
There are tests written in java that generate "Test.go" containing the sample maindriver.
They create a bunch a directories within /tmp i.e.

Usage:

Go to one of the test full context parsing directories within the /tmp directory:
/tmp/TestFullContextParsing-1467499156161# ls -lt
input-----IS A FILE HOLDING TEST INPUT
parser------IS A DIRECTORY HOLDING THE T.g4 and generated golang files
Test.go-----IS A FILE HOLDING THE MAINDRIVER CALLING PARSER HELD IN ./parser/

  1. 6.1)

Here is an example main driver as generated by pboyer/antlr4/runtime-testsuite/test/org/antlr/v4/test/runtime/go/:
Test.go:
package main
import (
"github.com/pboyer/antlr4/runtime/Go/antlr"
"./parser"
"os"
)

type TreeShapeListener struct {
*parser.BaseTListener
}

func NewTreeShapeListener() *TreeShapeListener {
return new(TreeShapeListener)
}

func (this *TreeShapeListener) EnterEveryRule(ctx antlr.ParserRuleContext) {
for i := 0; i<ctx.GetChildCount(); i++ {
child := ctx.GetChild(i)
parentR,ok := child.GetParent().(antlr.RuleNode)
if !ok || parentR.GetBaseRuleContext() != ctx.GetBaseRuleContext() {
panic("Invalid parse tree shape detected.")
}
}
}

func main() {
input := antlr.NewFileStream(os.Args[1])
lexer := parser.NewTLexer(input)
stream := antlr.NewCommonTokenStream(lexer,0)
p := parser.NewTParser(stream)
p.AddErrorListener(antlr.NewDiagnosticErrorListener(true))
p.BuildParseTrees = true
tree := p.Prog()
antlr.ParseTreeWalkerDefault.Walk(NewTreeShapeListener(), tree)
}

  1. 6.2)

Here are the contents of the test input file:
input:
a(i)<-x

  1. 6.3)

Here are the contents of the ./parser/T.g4 grammar that was generated into golang:
T.g4:
more T.g4
grammar T;
prog
@init {p.Interpreter.SetPredictionMode(antlr.PredictionModeLLExactAmbigDetection);}
: expr_or_assign*;
expr_or_assign
: expr '++' {fmt.Println("fail.")}
| expr {fmt.Println("pass: "+$expr.text)}
;
expr: expr_primary ('<-' ID)?;
expr_primary
: '(' ID ')'
| ID '(' ID ')'
| ID
;
ID : [a-z]+ ;

  1. 6.4)

Generate the golang go for the grammar described in T.g4:
cd /tmp/TestFullContextParsing-1467499156161/
antlr T.g4 -Dlanguage=Go

  1. 6.5)

Then build the Test.go maindriver's binary:
go build

  1. 6.6)

Then test the parser:
TestFullContextParsing-1467499156161 input

That's it.

I do hope it clarifies how to use this AWESOME GO LANGUAGE TOOL!

Gitter?

Any interest in setting up Gitter for pboyer/antlr4? I've never used it before, but it seems less clunky than filing issues when I want to ask dumb questions...

(@pboyer, @wjkohnen)

TestFailure: testPositionAdjustingLexer

testPositionAdjustingLexer(org.antlr.v4.test.runtime.go.TestLexerExec)  Time elapsed: 0.897 sec  <<< FAILURE!
org.junit.ComparisonFailure: expected:<...ns',<6>,1:0]
[@1,7:1[2='tokens',<4>,2:0]
[@2,14:14='{',<3>,2:7]
[@3,16:23='notLabel',<6>,3:0]
[@4,25:30='label1',<5>,4:0]
[@5,32:32='=',<1>,4:7]
[@6,34:39='label2',<5>,5:0]
[@7,41:42='+=',<2>,5:7]
[@8,44:51='notLabel',<6>,6:0]
[@9],53:52='<EOF>',<-1>,...> but was:<...ns',<6>,1:0]
[@1,7:1[4='tokens {',<4>,2:0]
[@2,16:23='notLabel',<6>,3:0]
[@3,25:32='label1 =',<5>,4:0]
[@4,34:42='label2 +=',<5>,5:0]
[@5,44:51='notLabel',<6>,6:0]
[@6],53:52='<EOF>',<-1>,...>
    at org.junit.Assert.assertEquals(Assert.java:115)
    at org.junit.Assert.assertEquals(Assert.java:144)
    at org.antlr.v4.test.runtime.go.TestLexerExec.testPositionAdjustingLexer(TestLexerExec.java:4759)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:622)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
    at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:74)

Performance tips

First of all, thanks for your contribution to antlr4 go.
I have read on antlr4 golang target issues that you are using it in non trivial production work. We are also considering it for parsing our graph database language spec. :)
Our language spec is a variant of GraphQL.

We started benchmarking from the simplest subset grammar.
Benchmarks :

dgraph/antlr4go/graphqlpm$ gotb -test.run=XXX -benchtime=2s -v
BenchmarkQuery/q1-4                 5000       1221967 ns/op
BenchmarkQuery/q2-4                 2000       1710850 ns/op
BenchmarkQuery/q3-4                 3000       1230518 ns/op
BenchmarkQuery/q4-4                 3000       1568564 ns/op
BenchmarkQuery/q5-4                 2000       1803392 ns/op
PASS
ok      github.com/dgraph-io/dgraph/antlr4go/graphqlpm    22.179s

We expected these numbers to be under 0.05 ms. They are currently around 1.5 ms.

Here are comparisons with handwritten parser and antlr golang parser over practical queries :
Benchmarks :

query$ gotb -test.run=XXX -benchtime=2s -v
BenchmarkQueryParse/spielberg:handwitten:-4               100000         46918 ns/op
BenchmarkQueryParse/spielberg:antlr:-4                      2000       1741364 ns/op
BenchmarkQueryParse/tomhanks:handwitten:-4                100000         25982 ns/op
BenchmarkQueryParse/tomhanks:antlr:-4                       2000       1654579 ns/op
BenchmarkQueryParse/nestedquery:handwritten:-4             30000         73053 ns/op
BenchmarkQueryParse/nestedquery:antlr:-4                    1000       3385005 ns/op
PASS
ok      github.com/dgraph-io/dgraph/query    21.922s

Antlr4 is around 40x slower.
Is this expected ? Or are we doing something wrong ?
Can you give some performance tips ? How can be benchmark lexer and parser steps separately ?

Help understanding test errors

OK, now that the easy test problems are fixed, I'm digging into failing tests, but having trouble understanding what they mean or how to dig into them. For example:

Running org.antlr.v4.test.runtime.go.TestCompositeParsers
dir /var/folders/bx/qk0phsxd265fqj512dnnpg080000gn/T/TestCompositeParsers-1464378084901/parser
antlr reports warnings from [-visitor, -Dlanguage=Go, -o, /var/folders/bx/qk0phsxd265fqj512dnnpg080000gn/T/TestCompositeParsers-1464378084901/parser, -lib, /var/folders/bx/qk0phsxd265fqj512dnnpg080000gn/T/TestCompositeParsers-1464378084901/parser, /var/folders/bx/qk0phsxd265fqj512dnnpg080000gn/T/TestCompositeParsers-1464378084901/parser/M.g4]
Message{errorType=IMPLICIT_TOKEN_DEFINITION, args=[B], e=null, fileName='/var/folders/bx/qk0phsxd265fqj512dnnpg080000gn/T/TestCompositeParsers-1464378084901/parser/M.g4', line=7, charPosition=4}

And:

dir /var/folders/bx/qk0phsxd265fqj512dnnpg080000gn/T/TestFullContextParsing-1464378174641/parser
exec stderrVacuum: line 1:5 reportAttemptingFullContext d=1 (e), input='34abc'
line 1:2 reportContextSensitivity d=1 (e), input='34'

And:

testLoopsSimulateTailRecursion(org.antlr.v4.test.runtime.go.TestFullContextParsing)  Time elapsed: 5.841 sec  <<< FAILURE!
java.lang.AssertionError: expected:<line 1:3 reportAttemptingFullContext d=3 (expr_primary), input='a(i)'
line 1:7 reportAmbiguity d=3 (expr_primary): ambigAlts={2, 3}, input='a(i)<-x'
> but was:<null>
    at org.junit.Assert.fail(Assert.java:88)
    at org.junit.Assert.failNotEquals(Assert.java:743)
    at org.junit.Assert.assertEquals(Assert.java:118)
    at org.junit.Assert.assertEquals(Assert.java:144)
    at org.antlr.v4.test.runtime.go.TestFullContextParsing.testLoopsSimulateTailRecursion(TestFullContextParsing.java:426)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
    at org.junit.rules.RunRules.evaluate(RunRules.java:20)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
    at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

And:

dir /var/folders/bx/qk0phsxd265fqj512dnnpg080000gn/T/TestLeftRecursion-1464378328580/parser
exec stderrVacuum: line 1:12 mismatched input '<EOF>' expecting '>>'

I've seen this error before:

dir /var/folders/bx/qk0phsxd265fqj512dnnpg080000gn/T/TestLeftRecursion-1464378296039/parser
exec stderrVacuum: # command-line-arguments
/var/folders/bx/qk0phsxd265fqj512dnnpg080000gn/T/TestLeftRecursion-1464378296039/Test.go:32: not enough arguments in call to p.A

Looks like for this one, TContext.A has zero params, but TParser.A has an int param. Is this supposed to be calling TContext.A or TParser.A (and if so, what should the int be)?

Any tips/insight appreciated!

some non-determinism in testExprAmbiguity_2(org.antlr.v4.test.runtime.go.TestFullContextParsing)?

Two test runs of the same test had different output, yielding in a pass and a fail. Maybe that is due to non-determinism of a Go map or something?

The failed test run put out ambigAlts={2, 1} instead of ambigAlts={1, 2}. Revision is 439a3b7. Apparently we'll have to run all tests a few hundred times, yay! Now I've run this test a dozen times and could not reproduce the fail.

I have arbitrarily chosen this test for debugging my git-bisect runner script. This is one of the tests that we've turned green in the last few days. Or maybe it was green all along and I just had some bad entropy in my test history? :)

Running org.antlr.v4.test.runtime.go.TestFullContextParsing
dir /tmp/TestFullContextParsing-1464523216232/parser
exec stderrVacuum: line 1:1 reportAttemptingFullContext d=1 (expr), input='+'
line 1:2 reportContextSensitivity d=1 (expr), input='+b'
line 1:3 reportAttemptingFullContext d=1 (expr), input='*'
line 1:5 reportAmbiguity d=1 (expr): ambigAlts={2, 1}, input='*c'

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 12.103 sec <<< FAILURE!
testExprAmbiguity_2(org.antlr.v4.test.runtime.go.TestFullContextParsing)  Time elapsed: 11.799 sec  <<< FAILURE!
org.junit.ComparisonFailure: expected:<... (expr): ambigAlts={[1, 2]}, input='*c'
> but was:<... (expr): ambigAlts={[2, 1]}, input='*c'
>
    at org.junit.Assert.assertEquals(Assert.java:115)
    at org.junit.Assert.assertEquals(Assert.java:144)
    at org.antlr.v4.test.runtime.go.TestFullContextParsing.testExprAmbiguity_2(TestFullContextParsing.java:208)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
    at org.junit.rules.RunRules.evaluate(RunRules.java:20)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:242)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:137)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
    at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

Results :

Failed tests:   testExprAmbiguity_2(org.antlr.v4.test.runtime.go.TestFullContextParsing): expected:<... (expr): ambigAlts={[1, 2]}, input='*c'(..)

TestFailure: testInvalidATNStateRemoval

This is an odd one and frankly I haven't got a foggiest what is going on. The test testInvalidATNStateRemoval's Test binary occupies 100% CPU and doesn't terminate. I have isolated the generated code and ran a pprof session. This is the (slightly modified) code of Test.go:

type TreeShapeListener struct {
        *parser.BaseTListener
}

func NewTreeShapeListener() *TreeShapeListener {
        return new(TreeShapeListener)
}

func (this *TreeShapeListener) EnterEveryRule(ctx antlr4.ParserRuleContext) {
        for i := 0; i < ctx.GetChildCount(); i++ {
                child := ctx.GetChild(i)
                parentR, ok := child.GetParent().(antlr4.RuleNode)
                if !ok || parentR.GetBaseRuleContext() != ctx.GetBaseRuleContext() {
                        panic("Invalid parse tree shape detected.")
                }
        }
}

func main() {
        f, err := os.Create("/tmp/pprof")
        if err != nil {
                panic(err)
        }
        pprof.StartCPUProfile(f)
        go func() {
                timer := time.NewTimer(2 * time.Minute)
                <-timer.C
                pprof.StopCPUProfile()
                f.Close()
                os.Exit(0)
        }()

        input := antlr4.NewFileStream("input")
        lexer := parser.NewTLexer(input)
        stream := antlr4.NewCommonTokenStream(lexer, 0)
        p := parser.NewTParser(stream)
        p.BuildParseTrees = true
        tree := p.Start()
        antlr4.ParseTreeWalkerDefault.Walk(NewTreeShapeListener(), tree)
}

Code after tree := doesn't seem to ever be reached and so EnterEveryRule is never called. The profiler shows, that the ParserATNSimulatortries to put a lot into some Set which results into a lot of equals calls.

Now the two things that confuse me the most are that apparently I am the only one who observes this(?) and when I try to debug this with Delve the binary does(!) terminate.

This is the CPU profile:

testInvalidATNStateRemoval-pprof

and the test grammar:

grammar T;
start : ID ':' expr;
expr : primary expr? {} | expr '->' ID;
primary : ID;
ID : [a-z]+;

The input file:

x:x

Can anyone else reproduce this? What does this code path try to accomplish in the first place? (I am not an expert in augmented transition networks.)

Because delve session terminates I figured there migth be a race condition. Running the binary with -race for two hours did not offer any insight.

TestFailure: TestListeners.testBasic

testBasic(org.antlr.v4.test.runtime.go.TestListeners)  Time elapsed: 2.195 sec  <<< FAILURE!
org.junit.ComparisonFailure: expected:<(a 1 2)
[1
2
]> but was:<(a 1 2)
[]>
    at org.junit.Assert.assertEquals(Assert.java:115)
    at org.junit.Assert.assertEquals(Assert.java:144)
    at org.antlr.v4.test.runtime.go.TestListeners.testBasic(TestListeners.java:54)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:622)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
    at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:74)

Is this dead? :(

@pboyer @wjkohnen Are you guys still interested in fixing the remaining test failures and getting this thing pulled upstream? I feel like we're close, but it seems like you've lost interest. Should I move on?

Golang visitor example?

I've been working through the ANTLR book, however, not knowing Java I'm a bit unsure how a Visitor implementation should look like in Go. Would be great to get a code snippet showing this (and maybe include in official documentation?) if it's not too much trouble.

TestFailure: testAmbiguityNoLoop

testAmbiguityNoLoop(org.antlr.v4.test.runtime.go.TestFullContextParsing)  Time elapsed: 1.921 sec  <<< FAILURE!
org.junit.ComparisonFailure: expected:<[alt 1
]> but was:<[]>
    at org.junit.Assert.assertEquals(Assert.java:115)
    at org.junit.Assert.assertEquals(Assert.java:144)
    at org.antlr.v4.test.runtime.go.TestFullContextParsing.testAmbiguityNoLoop(TestFullContextParsing.java:53)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:622)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
    at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:74)

_x redeclared in this block

First of all Peter, thanks this is looking good.

I've found a case where generated code produces a compile.
The var _x is redeclared when assigning a rule to a variable twice in the same line.

grammar example
part : Name=id | From=id COLON To=id // <-- offending line ;

generated code
`
case 2:
p.EnterOuterAlt(localctx, 2)
p.SetState(39)

	var _x = p.Id()

	localctx.(*PartContext).From = _x

	p.SetState(40)
	p.Match(RefParserCOLON)

	p.SetState(41)

	var _x = p.Id()

	localctx.(*PartContext).To = _x

`

File name case

In most of the Go code I've seen, file names have used snake case. It's even used in the documentation. What do you think about renaming the runtime files to use lowercase snake case?

TestFailure: testZeroLengthToken

testZeroLengthToken(org.antlr.v4.test.runtime.go.TestLexerExec)  Time elapsed: 0.902 sec  <<< FAILURE!
org.junit.ComparisonFailure: expected:<[@0,0:[4=''xxx'',<1>,1:0]
[@1],5:4='<EOF>',<-1>,1:...> but was:<[@0,0:[0=''',<2>,1:0]
[@1,1:1='x',<3>,1:1]
[@2,4:4=''',<2>,1:4]
[@3],5:4='<EOF>',<-1>,1:...>
    at org.junit.Assert.assertEquals(Assert.java:115)
    at org.junit.Assert.assertEquals(Assert.java:144)
    at org.antlr.v4.test.runtime.go.TestLexerExec.testZeroLengthToken(TestLexerExec.java:4955)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:622)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
    at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:74)

Build issue on generated golang code

Hi!

I wrote a simple grammar to parse instance lines in STEP format (STEP.g4)

Grammar is ok, i already generated working Python code.
Golang code generation works too, but I can't build the generated golang source, especially step_parser.go:

tech.fr/parser

tech.fr/parser/step_parser.go:408: cannot use s (type *ParameterContext) as type antlr4.RuleContext in return argument:
*ParameterContext does not implement antlr4.RuleContext (wrong type for String method)
have String() antlr4.TerminalNode
want String([]string, antlr4.RuleContext) string
tech.fr/parser/step_parser.go:425: cannot use NewParameterContext(p, p.BaseParser.GetParserRuleContext(), p.BaseParser.BaseRecognizer.GetState()) (type *ParameterContext) as type IParameterContext in assignment:
*ParameterContext does not implement IParameterContext (wrong type for String method)
have String() antlr4.TerminalNode
want String([]string, antlr4.RuleContext) string

Any clue to make this work?
Pierre
STEP.g4.txt
step_parser.go.txt

TestFailure: testInvalidATNStateRemoval

testInvalidATNStateRemoval(org.antlr.v4.test.runtime.go.TestParserErrors)  Time elapsed: 60.004 sec  <<< ERROR!
java.lang.Exception: test timed out after 60000 milliseconds
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:502)
    at java.lang.UNIXProcess.waitFor(UNIXProcess.java:181)
    at org.antlr.v4.test.runtime.go.BaseTest.execModule(BaseTest.java:463)
    at org.antlr.v4.test.runtime.go.BaseTest.execRecognizer(BaseTest.java:447)
    at org.antlr.v4.test.runtime.go.BaseTest.execParser(BaseTest.java:394)
    at org.antlr.v4.test.runtime.go.TestParserErrors.testInvalidATNStateRemoval(TestParserErrors.java:152)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:622)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
    at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:74)

TestFailure: testReturnValueAndActionsList1_2

testReturnValueAndActionsList1_2(org.antlr.v4.test.runtime.go.TestLeftRecursion)  Time elapsed: 2.364 sec  <<< FAILURE!
org.junit.ComparisonFailure: expected:<...pr (expr a) , (expr [c) >> (expr x])) <EOF>)
> but was:<...pr (expr a) , (expr [(expr c) >> (expr x)])) <EOF>)
>
    at org.junit.Assert.assertEquals(Assert.java:115)
    at org.junit.Assert.assertEquals(Assert.java:144)
    at org.antlr.v4.test.runtime.go.TestLeftRecursion.testReturnValueAndActionsList1_2(TestLeftRecursion.java:2082)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:622)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
    at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:74)```

Deviation in parser_atn_simulator.go

\go\work\src\sridharxp\antlr4\runtime\Go\antlr\parser_atn_simulator.go
On line 1517, 1528, 1541 three identical lines deviate from java code.
It has no effect on tests though.
Is this intentional?
code
var interval = NewInterval(startIndex, stopIndex+1)
code following java
var interval = NewInterval(startIndex, stopIndex)

Running tests/viewing generated code

(I'm brand new to developing on ANTLR.)

I followed your instructions and ran mvn install -Dlanguage=Go to run the tests, and got this output in part:

[...]
Tests run: 23, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 115.008 sec

Results :

Failed tests:   testAmbiguityNoLoop(org.antlr.v4.test.runtime.go.TestFullContextParsing): expected:<[alt 1(..)
  testLoopsSimulateTailRecursion(org.antlr.v4.test.runtime.go.TestFullContextParsing): expected:<line 1:3 reportAttemptingFullContext d=3 (expr_primary), input='a(i)'(..)
  testDirectCallToLeftRecursiveRule_1(org.antlr.v4.test.runtime.go.TestLeftRecursion): expected:<[(a x)(..)
  testDirectCallToLeftRecursiveRule_2(org.antlr.v4.test.runtime.go.TestLeftRecursion): expected:<[(a (a x) y)(..)
  testDirectCallToLeftRecursiveRule_3(org.antlr.v4.test.runtime.go.TestLeftRecursion): expected:<[(a (a (a x) y) z)(..)
  testReturnValueAndActionsList1_2(org.antlr.v4.test.runtime.go.TestLeftRecursion): expected:<...pr (expr a) , (expr [c) >> (expr x])) <EOF>)(..)
  testReturnValueAndActionsList1_4(org.antlr.v4.test.runtime.go.TestLeftRecursion): expected:<...* (expr b)) , (expr [c) , (expr (expr x) * (expr y)) >> (expr r)]) <EOF>)(..)
  testReturnValueAndActionsAndLabels_1(org.antlr.v4.test.runtime.go.TestLeftRecursion): expected:<[4(..)
  testReturnValueAndActionsAndLabels_2(org.antlr.v4.test.runtime.go.TestLeftRecursion): expected:<[3(..)
  testReturnValueAndActionsAndLabels_3(org.antlr.v4.test.runtime.go.TestLeftRecursion): expected:<[7(..)
  testReturnValueAndActionsAndLabels_4(org.antlr.v4.test.runtime.go.TestLeftRecursion): expected:<[12(..)
  testMultipleAlternativesWithCommonLabel_1(org.antlr.v4.test.runtime.go.TestLeftRecursion): expected:<[4(..)
  testMultipleAlternativesWithCommonLabel_2(org.antlr.v4.test.runtime.go.TestLeftRecursion): expected:<[3(..)
  testMultipleAlternativesWithCommonLabel_3(org.antlr.v4.test.runtime.go.TestLeftRecursion): expected:<[7(..)
  testMultipleAlternativesWithCommonLabel_4(org.antlr.v4.test.runtime.go.TestLeftRecursion): expected:<[12(..)
  testSemPred(org.antlr.v4.test.runtime.go.TestLeftRecursion): expected:<[(s (a (a (a x) y) z))(..)
  testPositionAdjustingLexer(org.antlr.v4.test.runtime.go.TestLexerExec): expected:<...ns',<6>,1:0](..)
  testZeroLengthToken(org.antlr.v4.test.runtime.go.TestLexerExec): expected:<[@0,0:[4=''xxx'',<1>,1:0](..)
  testBasic(org.antlr.v4.test.runtime.go.TestListeners): expected:<(a 1 2)(..)
  testLRWithLabels(org.antlr.v4.test.runtime.go.TestListeners): expected:<..., (e 3)) ))(..)
  testTokenGetters_1(org.antlr.v4.test.runtime.go.TestListeners): expected:<(a 1 2)(..)
  testTokenMismatch(org.antlr.v4.test.runtime.go.TestParserErrors): expected:<line 1:1 mis[m]atched input 'a' exp...> but was:<line 1:1 mis[M]atched input 'a' exp...>
  testContextListGetters(org.antlr.v4.test.runtime.go.TestParserErrors): expected:<[abab(..)
  testTokenMismatch2(org.antlr.v4.test.runtime.go.TestParserErrors): expected:<line 1:2 mis[m]atched input '~FORCE...> but was:<line 1:2 mis[M]atched input '~FORCE...>
  testInvalidATNStateRemoval(org.antlr.v4.test.runtime.go.TestParserErrors): expected null, but was:<runtime: goroutine stack exceeds 1000000000-byte limit(..)
  testNoViableAltAvoidance(org.antlr.v4.test.runtime.go.TestParserErrors): expected:<line 1:1 mis[m]atched input '.' exp...> but was:<line 1:1 mis[M]atched input '.' exp...>
  testPredictionIssue334(org.antlr.v4.test.runtime.go.TestParserExec): expected:<[(file_ (item a) <EOF>)(..)
  testPredicatedIfIfElse(org.antlr.v4.test.runtime.go.TestParserExec): expected null, but was:<# _/var/folders/bx/qk0phsxd265fqj512dnnpg080000gn/T/TestParserExec-1463769190432/parser(..)
  testParserProperty(org.antlr.v4.test.runtime.go.TestParserExec): expected:<[valid(..)
  testTokenAndRuleContextString(org.antlr.v4.test.runtime.go.TestParseTrees): expected:<[a[,] s](..)
  testNoViableAlt(org.antlr.v4.test.runtime.go.TestParseTrees): expected:<line 1:0 mis[m]atched input 'z' exp...> but was:<line 1:0 mis[M]atched input 'z' exp...>
  test2UnpredicatedAlts(org.antlr.v4.test.runtime.go.TestSemPredEvalParser): expected:<...d=0 (a): ambigAlts={[1, 2]}, input='y'(..)
  testActionsHidePredsInGlobalFOLLOW(org.antlr.v4.test.runtime.go.TestSemPredEvalParser): expected:<[eval=true(..)
  testDepedentPredsInGlobalFOLLOW(org.antlr.v4.test.runtime.go.TestSemPredEvalParser): expected:<[eval=true(..)
  testIndependentPredNotPassedOuterCtxToAvoidCastException(org.antlr.v4.test.runtime.go.TestSemPredEvalParser): expected:<[alt 2(..)
  testPredsInGlobalFOLLOW(org.antlr.v4.test.runtime.go.TestSemPredEvalParser): expected:<[eval=true(..)
  testPredFromAltTestedInLoopBack_1(org.antlr.v4.test.runtime.go.TestSemPredEvalParser): expected:<[(file_ (para (paraContent s) \n \n) (para (paraContent \n x \n)) <EOF>)(..)
  testPredFromAltTestedInLoopBack_2(org.antlr.v4.test.runtime.go.TestSemPredEvalParser): expected:<[(file_ (para (paraContent s) \n \n) (para (paraContent \n x) \n \n) <EOF>)(..)
  testToLeft(org.antlr.v4.test.runtime.go.TestSemPredEvalParser): expected:<alt 2(..)

Tests run: 314, Failures: 39, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] ANTLR 4 ............................................ SUCCESS [  4.684 s]
[INFO] ANTLR 4 Runtime .................................... SUCCESS [ 27.035 s]
[INFO] ANTLR 4 Tool ....................................... SUCCESS [ 25.449 s]
[INFO] ANTLR 4 Maven plugin ............................... SUCCESS [ 19.300 s]
[INFO] ANTLR 4 Runtime Test Generator ..................... FAILURE [  01:38 h]
[INFO] ANTLR 4 Tool Tests ................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE

I was expecting failures, as described in your post, but just wanted to double check this is what I should be expecting. Not sure, but aren't the Go templates tested under "Tool Tests"? It says those tests were skipped.

It took a long time for the install command to run. Is there a way to shorten it by running only the Go tests? Or is that what that language=Go flag is doing?

Can you give some quick instructions for how to run it on a sample grammar to see the generated code?

Visitor doesn't visit parse tree

Hey! Looks like Visit() isn't implemented in BaseParseTreeVisitor. I realize that Go can make this sort of a pain, but this generic visitor method works for me

func Visit(tree antlr.Tree, visitor antlr.ParseTreeVisitor) {
    tval, ttype, tname := valueAndType(tree)
    vval, vtype, _ := valueAndType(visitor)
    mname := typeToMethodName(tname)
    var argval reflect.Value
    switch ttype.Kind() {
    case reflect.Struct:
        argval = tval
    case reflect.Ptr:
        argval = reflect.ValueOf(tree)
        vval = reflect.ValueOf(visitor)
    }

    method, ok := vtype.MethodByName(mname)
    if ok {
        method.Func.Call([]reflect.Value{
            vval,
            argval,
        })
    }

    for i := 0;  i < tree.GetChildCount(); i++ {
        Visit(tree.GetChild(i), visitor)
    }
}

func valueAndType(o interface{}) (reflect.Value, reflect.Type, string) {
    fval := reflect.Indirect(reflect.ValueOf(o))
    tname := fval.Type().Name()
    return fval, reflect.TypeOf(o), tname
}

func typeToMethodName(in string) string {
    length := len(in)
    ctxlen := len("Context")
    return fmt.Sprintf("Visit%s", in[:(length - ctxlen)])
}

What do you think?
Best!
Josiah

Tool src modification

Files in tool/src... are modified for golang port.
In files LeftRecursiveRuleFunction, RuleActionFunction, RuleFunction, RuleSempredFunction, CodeGenerator variables are added for use. In Recognizer.java code is modified to export lists with the possibility of clashing with other ports. Why not modify Go.stg to use arrays? AddedcontextSuperClassvariage from 5.4.3 to the template also.
Go.txt
Recognizer.txt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.