-
Notifications
You must be signed in to change notification settings - Fork 23
Configuring the PDDL parser
Note that a PDDL parser is included in the VAL binaries, so if you let the PDDL extension download those when prompted, you do not need to read this.
End users can configure the PDDL extension to use their own PDDL parser to validate their PDDL input files using their own parser. Such parser may validate PDDL domain and problem files for syntactic, lexical, or even logical issues. It may generate Errors, Warnings, Information or Hint. There are two shapes of parsers supported:
- parser executables
- parsing service
To configure a parser, invoke the "Configure PDDL parser" command (using Ctrl+Shift+P) and follow the instructions.
For parser executables, your configuration will be stored in following settings:
-
pddlParser.executableOrService
(mandatory settings pointing to the executable/command) -
pddlParser.executableOptions
(optional specification of command line arguments) -
pddlParser.problemPattern
(optional regular expression pattern for matching problems in the parser output)
For parser service, specify the url into the pddlParser.executableOrService
setting e.g. http[s]://server/parse
If you are interested to build your own service, email me at dolejsi_pddl at outlook dot com and I can share the openapi.yaml, which is a contract the extension expects such service to fulfill.
Pddl4j supports both parsing of propositional PDDL and (simple) planning. To use it as a parser, use following command (pddlParser.executableOrService
):
java
and command line arguments in (pddlParser.executableOptions
):
-javaagent:c:/tools/pddl4j/pddl4j-3.5.0.jar -server -Xms2048m -Xmx2048m fr.uga.pddl4j.parser.Parser -o $(domain) -f $(problem)
where -o
and -f
are the switches expected by the parser.
The VAL toolset includes a parser Parser[.exe]
. It is the same parser used inside the POPF planner. Assuming you have the location of the executable included into your %path%
environment variable, simply specify set the name of the parser executable (pddlParser.executableOrService
setting):
Parser.exe
and use the default command line options (pddlParser.executableOptions
setting):
$(domain) $(problem)
To define a custom parser, you need to configure the pattern for finding problems in the parser standard output using the pddlParser.problemPattern
setting. The syntax for that setting is as follows:
/pattern/flags/order
The pattern
part is a regular expression pattern, which must use a $(filePaths)
macro as a placeholder for the parsed file names. The macro will get replaced by something like domain.pddl|problem.pddl
.
The flags
may be any RegExp flag (compatible with JavaScript subset of RegExp), such as igm
. See regular expression documentation for more info. You can test your regular expression using the Regex101 site (do not forget to switch it to JavaScript flavor. See example here: https://regex101.com/r/sY2gK3/1 (this is the pattern used for pddl4j).
Lastly, the order
part is a comma-separated list of the capturing groups inside the the regular expression pattern. This tells the extension which of the capturing group captures which part of the problem. It is a 1-based index. The numbers in the list are expected in this order:
filename,severity,line,column,message
As an example, here are the two hardcoded custom patterns that the extension is already programmed to use (first corresponds to the POPF parser and the second to pddl4j):
/^($(filePaths))\\s*:\\s*line\\s*:\\s*(\\d*)\\s*:\\s*(Error|Warning)\\s*:\\s*(.*)$/gmi/1,3,2,0,4
/(error|warning) at line (\\d+), column (\\d+), file \\(($(filePaths))\\)\\s*:\\s*(.+)/ig/4,1,2,3,5
To learn more about how exactly such settings are handled by Visual Studio Code, read this page: https://code.visualstudio.com/docs/getstarted/settings.
If you have other parsers that are not listed here and want to share a pointer to them and recommended configuration, let me know (dolejsi_pddl at outlook dot com) and I will add the description here.