grammars-v4 icon indicating copy to clipboard operation
grammars-v4 copied to clipboard

Addition of Multi-Agent PDDL to ANTLR v4

Open refracc opened this issue 1 year ago • 7 comments

Still parses standard PDDL files, as well as new MA-PDDL files (which are almost up to the full specification of Kovacs, 2012).

refracc avatar Mar 29 '24 15:03 refracc

There is not a single test file for this grammar. I went to http://www.plg.inf.uc3m.es/ipc2011-deterministic/Resources , downloaded the .bz2 file (http://www.plg.inf.uc3m.es/ipc2011-deterministic/attachments/Resources/ipc2008-no-cybersec.tar.bz2), extracted the demos, and tried every single .pddl file. Some parsed (about 30 files in seq-opt/pegsol-strips/p[0-9][0-9].pddl) but most did not.

It's time to try to get this grammar up to a basic level of usability that people expect. Currently, I'm not sure how usable it is.

kaby76 avatar Mar 29 '24 22:03 kaby76

If it's not a problem, could you "fast forward" the branch for this PR with the current "master" branch in https://github.com/antlr/grammars-v4.git ?? It'll help me see how my new "perf" scripts handle your PR. Thanks!

kaby76 avatar Mar 29 '24 22:03 kaby76

There is not a single test file for this grammar. I went to http://www.plg.inf.uc3m.es/ipc2011-deterministic/Resources , downloaded the .bz2 file (http://www.plg.inf.uc3m.es/ipc2011-deterministic/attachments/Resources/ipc2008-no-cybersec.tar.bz2), extracted the demos, and tried every single .pddl file. Some parsed (about 30 files in seq-opt/pegsol-strips/p[0-9][0-9].pddl) but most did not.

It's time to try to get this grammar up to a basic level of usability that people expect. Currently, I'm not sure how usable it is.

Considering that there were no prior instances provided alongside the PDDL parser or its application to domains (i.e., their specification), I am perplexed as to why - particularly in light of the lack of examples initially presented in the folder - this seems to have become an apparent issue. Could you kindly clarify why the previous author was not prompted to include examples, or why none were included here initially?

I have taken the liberty of incorporating examples of the contrived "single-agent" problems, along with the contrived "multi-agent" domains that this file can parse, and they do align with some aspects of the Kovacs implementation. As articulated in my comment within the parser file itself, further refinement is necessary to bring it up to par with this standard. Nevertheless, this should serve as a commendable starting point towards achieving that objective.

Furthermore, the branch has been fast-forwarded to accommodate your new scripts.

refracc avatar Apr 03 '24 15:04 refracc

Could you kindly clarify why the previous author was not prompted to include examples, or why none were included here initially?

@teverett added the grammar 9 years ago, probably as a task of translating the grammar from Antlr3 into Antlr4. But, he didn't have any sample input. I added the desc.xml last year in order to support testing of all targets, but again, I punted on finding any tests because I really don't have expertise in the language.

Nevertheless, this should serve as a commendable starting point towards achieving that objective.

Ty, Ty, Ty!!

kaby76 avatar Apr 03 '24 19:04 kaby76

Please change desc.xml to this so we can test both grammars.

<?xml version="1.0" encoding="UTF-8" ?>
<desc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../_scripts/desc.xsd">
   <targets>CSharp;Dart;Go;Java;JavaScript;PHP;Python3;TypeScript;Antlr4ng</targets>
   <test>
      <name>multi</name>
      <grammar-files>MultiAgentPDDL.g4</grammar-files>
      <inputs>multi-agent-examples/**/*.pddl</inputs>
   </test>
   <test>
      <name>single</name>
      <grammar-files>SingleAgentPDDL.g4</grammar-files>
      <inputs>single-agent-examples/**/*.pddl</inputs>
   </test>
</desc>

kaby76 avatar Apr 05 '24 12:04 kaby76

Please change desc.xml to this so we can test both grammars.

<?xml version="1.0" encoding="UTF-8" ?>
<desc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../_scripts/desc.xsd">
   <targets>CSharp;Dart;Go;Java;JavaScript;PHP;Python3;TypeScript;Antlr4ng</targets>
   <test>
      <name>multi</name>
      <grammar-files>MultiAgentPDDL.g4</grammar-files>
      <inputs>multi-agent-examples/**/*.pddl</inputs>
   </test>
   <test>
      <name>single</name>
      <grammar-files>SingleAgentPDDL.g4</grammar-files>
      <inputs>single-agent-examples/**/*.pddl</inputs>
   </test>
</desc>

All files should now parse under the one grammar file. See my latest commit. I've updated the test in desc.xml to reflect that.

refracc avatar Apr 05 '24 12:04 refracc

Yes, better.

Looks like still a few problems.

$ trgen -t CSharp
C:\msys64\home\Kenne\issues\g4-4034\g4-4034\pddl
CSharp  Pddl.g4 success 0.0484755
Rendering template file from CSharp/Other.csproj to ./Generated-CSharp-Pddl/Other.csproj
Rendering template file from CSharp/st.build.ps1 to ./Generated-CSharp-Pddl/st.build.ps1
Rendering template file from CSharp/st.build.sh to ./Generated-CSharp-Pddl/st.build.sh
Rendering template file from CSharp/st.clean.ps1 to ./Generated-CSharp-Pddl/st.clean.ps1
Rendering template file from CSharp/st.clean.sh to ./Generated-CSharp-Pddl/st.clean.sh
Rendering template file from CSharp/st.Encodings.cs to ./Generated-CSharp-Pddl/st.Encodings.cs
Rendering template file from CSharp/st.ErrorListener.cs to ./Generated-CSharp-Pddl/st.ErrorListener.cs
Rendering template file from CSharp/st.makefile to ./Generated-CSharp-Pddl/st.makefile
Rendering template file from CSharp/st.perf.sh to ./Generated-CSharp-Pddl/st.perf.sh
Rendering template file from CSharp/st.run.ps1 to ./Generated-CSharp-Pddl/st.run.ps1
Rendering template file from CSharp/st.run.sh to ./Generated-CSharp-Pddl/st.run.sh
Rendering template file from CSharp/st.test-cover.sh to ./Generated-CSharp-Pddl/st.test-cover.sh
Rendering template file from CSharp/st.Test.cs to ./Generated-CSharp-Pddl/st.Test.cs
Rendering template file from CSharp/st.test.ps1 to ./Generated-CSharp-Pddl/st.test.ps1
Rendering template file from CSharp/st.test.sh to ./Generated-CSharp-Pddl/st.test.sh
Rendering template file from CSharp/Test.csproj.st to ./Generated-CSharp-Pddl/Test.csproj.st
Copying source file from C:/msys64/home/Kenne/issues/g4-4034/g4-4034/pddl/README.md to ./Generated-CSharp-Pddl/README.md
Copying source file from C:/msys64/home/Kenne/issues/g4-4034/g4-4034/pddl/Pddl.g4 to ./Generated-CSharp-Pddl/Pddl.g4
Copying source file from C:/msys64/home/Kenne/issues/g4-4034/g4-4034/pddl/desc.xml to ./Generated-CSharp-Pddl/desc.xml
04/05-09:11:42 ~/issues/g4-4034/g4-4034/pddl
$ make
mingw32-make: *** No targets specified and no makefile found.  Stop.
04/05-09:11:43 ~/issues/g4-4034/g4-4034/pddl
$ cd Generated-CSharp-Pddl/
04/05-09:11:46 ~/issues/g4-4034/g4-4034/pddl/Generated-CSharp-Pddl
$ make
bash build.sh
  Determining projects to restore...
  Restored C:\msys64\home\Kenne\issues\g4-4034\g4-4034\pddl\Generated-CSharp-Pddl\Test.csproj (in 337 ms).
MSBuild version 17.9.4+90725d08d for .NET
  Determining projects to restore...
  All projects are up-to-date for restore.
  Test -> C:\msys64\home\Kenne\issues\g4-4034\g4-4034\pddl\Generated-CSharp-Pddl\bin\Debug\net8.0\Test.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:04.60
04/05-09:11:53 ~/issues/g4-4034/g4-4034/pddl/Generated-CSharp-Pddl
$ make test
bash test.sh
New errors in output.
examples/multi-agent/wireless/domain.pddl.errors
line 74:15 mismatched input '?sender' expecting {'(', 'at', 'over', NAME, NUMBER}
examples/single-agent/barman-sequential-satisficing/domain.pddl.errors
line 2:33 extraneous input ':action' expecting {')', REQUIRE_KEY}
examples/single-agent/depots-strips-hand-coded/instance-1.pddl.errors
line 28:15 extraneous input '-' expecting {')', 'at', 'over', NAME}
line 30:1 no viable alternative at input '(:predicates'
line 31:14 mismatched input 'on' expecting ':goal'
line 32:13 mismatched input '(' expecting <EOF>
examples/single-agent/openstacks-temporal-satisficing-adl-numeric-fluents/domain.pddl.errors
line 2:46 token recognition error at: ':nu'
line 2:49 extraneous input 'meric-fluents' expecting {')', REQUIRE_KEY}
examples/single-agent/openstacks-temporal-satisficing-adl-numeric-fluents/instance-1.pddl.errors
line 41:19 no viable alternative at input '(total-time'
line 43:0 extraneous input ')' expecting <EOF>
examples/single-agent/openstacks-temporal-satisficing-adl-numeric-fluents/instance-10.pddl.errors
line 77:19 no viable alternative at input '(total-time'
line 79:0 extraneous input ')' expecting <EOF>
examples/single-agent/openstacks-temporal-satisficing-adl-numeric-fluents/instance-20.pddl.errors
line 117:19 no viable alternative at input '(total-time'
line 119:0 extraneous input ')' expecting <EOF>
examples/single-agent/openstacks-temporal-satisficing-adl-numeric-fluents/instance-30.pddl.errors
line 157:19 no viable alternative at input '(total-time'
line 159:0 extraneous input ')' expecting <EOF>
examples/single-agent/road-traffic-accident-management-temporal-satisficing/instance-1.pddl.errors
line 395:19 no viable alternative at input '(total-time'
line 396:0 extraneous input ')' expecting <EOF>
examples/single-agent/road-traffic-accident-management-temporal-satisficing/instance-10.pddl.errors
line 446:19 no viable alternative at input '(total-time'
line 447:0 extraneous input ')' expecting <EOF>
examples/single-agent/road-traffic-accident-management-temporal-satisficing/instance-20.pddl.errors
line 697:19 no viable alternative at input '(total-time'
line 698:0 extraneous input ')' expecting <EOF>
examples/single-agent/sokoban-temporal-satisficing/instance-1.pddl.errors
line 344:21 no viable alternative at input '(total-time'
line 345:0 extraneous input ')' expecting <EOF>
examples/single-agent/sokoban-temporal-satisficing/instance-10.pddl.errors
line 383:21 no viable alternative at input '(total-time'
line 384:0 extraneous input ')' expecting <EOF>
examples/single-agent/sokoban-temporal-satisficing/instance-20.pddl.errors
line 375:21 no viable alternative at input '(total-time'
line 376:0 extraneous input ')' expecting <EOF>
examples/single-agent/transport-sequential-satisficing/domain.pddl.errors
line 5:25 extraneous input ':action' expecting {')', REQUIRE_KEY}
examples/single-agent/trucks-preferences-simple/instance-1.pddl.errors
line 66:2 no viable alternative at input '(preference'
line 68:1 missing ')' at '('
examples/single-agent/trucks-preferences-simple/instance-10.pddl.errors
line 410:2 no viable alternative at input '(preference'
line 412:1 missing ')' at '('
examples/single-agent/trucks-preferences-simple/instance-20.pddl.errors
line 993:2 no viable alternative at input '(preference'
line 994:1 missing ')' at '('
Test failed.
mingw32-make: *** [makefile:8: test] Error 1
04/05-09:12:11 ~/issues/g4-4034/g4-4034/pddl/Generated-CSharp-Pddl
$

kaby76 avatar Apr 05 '24 13:04 kaby76