congo-cc / congo-parser-generator

The CongoCC Parser Generator, the Next Generation of JavaCC 21, which in turn was the next generation of JavaCC
https://discuss.congocc.org/
Other
36 stars 11 forks source link

Cannot update bootstrap jar - failure related to setting a production node property? #124

Closed vsajip closed 6 months ago

vsajip commented 6 months ago

As per the title. Console session illustrates:

$ ant update-bootstrap
Buildfile: /disk2/projects/congocc/build.xml

update-bootstrap:
     [echo] Ensuring templates are up to date in the bootstrap jar ...

clean:
   [delete] Deleting directory /disk2/projects/congocc/build

init:

build-parsers:

parser-gen:

ppline-gen:

csharp-gen:

preprocessor-gen:

python-gen:
     [echo] Building parser from src/grammars/PythonInternal.ccc
     [echo] Building parser from examples/csharp/PPDirectiveLine.ccc
     [echo] Building parser from src/grammars/CongoCC.ccc
     [echo] Building parser from examples/preprocessor/Preprocessor.ccc
     [echo] Building parser from src/grammars/CSharpInternal.ccc

compile:
    [javac] Compiling 632 source files to /disk2/projects/congocc/build
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
     [copy] Copying 40 files to /disk2/projects/congocc/build/templates
     [copy] Copying 20 files to /disk2/projects/congocc/build/include

jar:
     [echo] Creating jar with all dependencies included
      [jar] Building jar: /disk2/projects/congocc/congocc.jar
     [echo] Copying current jar to bootstrap location ...
     [copy] Copying 1 file to /disk2/projects/congocc/bin
     [echo] Ensuring any generated code is up to date in the bootstrap jar ...

clean:
   [delete] Deleting: /disk2/projects/congocc/congocc.jar
   [delete] Deleting directory /disk2/projects/congocc/build

init:

build-parsers:

parser-gen:
     [echo] Building parser from src/grammars/CongoCC.ccc

preprocessor-gen:
     [echo] Building parser from examples/preprocessor/Preprocessor.ccc

ppline-gen:
     [echo] Building parser from examples/csharp/PPDirectiveLine.ccc

python-gen:
     [echo] Building parser from src/grammars/PythonInternal.ccc

csharp-gen:
     [echo] Building parser from src/grammars/CSharpInternal.ccc
     [java] Error: src/grammars/CongoCC.ccc:1221:8:Cannot assign to production node property or named child list; production node is never instantiated.

BUILD FAILED
/disk2/projects/congocc/build.xml:194: The following error occurred while executing this line:
/disk2/projects/congocc/build.xml:86: The following error occurred while executing this line:
/disk2/projects/congocc/build.xml:69: The following error occurred while executing this line:
/disk2/projects/congocc/build.xml:60: Java returned: 1

Total time: 41 seconds

There's the offending line: https://github.com/congo-cc/congo-parser-generator/blob/b94681c3ba0cbdc734e3b9c3cb5aadeceaeb08f3/src/grammars/CongoCC.ccc#L1221 Perhaps @adMartem might like to look into this?

revusky commented 6 months ago

Gee, I still don't really have a clue (yet) about these newer tree-building annotations, like =? and so on. I was rather surprise to see this in the core CongoCC.ccc grammar. Is it possible that John was experimenting with this locally and inadvertently committed this?

adMartem commented 6 months ago

No, I think I meant it (I changed some of the CongoCC.ccc productions that were doing equivalent things to the more terse notation). You are correct, exactly as described. I'll look at this.

adMartem commented 6 months ago

I could swear I did an update-bootstrap many times after making this change. But apparently not.

adMartem commented 6 months ago

Oh, I see. My sanity check I recently added now detects this. Before that, it was just ignored (and apparently cause no detected problem).

adMartem commented 6 months ago

This was too clever by half. It looks like it worked before, but the static sanity check failed (as designed), not realizing that the production node being referenced was not the parent production of the assignment, but rather an augument to it. I'll put it back the way it was before. I think you (Jon) were correct, I was doing this as an experiment and forgot and left it in. See line 1204.