concepts.pdsketch.parsers.pdsketch_v3_parser.PDSketchV3Parser#
- class PDSketchV3Parser[source]#
Bases:
object
The parser for PDSketch v3.
Methods
parse
(filename)Parse a PDSketch v3 file.
parse_domain
(filename)Parse a PDSketch v3 domain file.
parse_domain_str
(s[, domain])Parse a PDSketch v3 domain string.
parse_expression
(s, domain[, state, ...])Parse a PDSketch v3 expression string.
parse_problem
(filename[, domain])Parse a PDSketch v3 problem file.
parse_problem_str
(s[, domain])Parse a PDSketch v3 problem string.
parse_str
(s)Parse a PDSketch v3 string.
transform_domain
(tree[, domain])Transform a parse tree into a domain.
transform_expression
(tree, domain[, state, ...])Transform a parse tree into an expression.
transform_problem
(tree[, domain])Transform a parse tree into a problem.
Attributes
The grammar definition v3 for PDSketch.
- __new__(**kwargs)#
- parse(filename)[source]#
Parse a PDSketch v3 file.
- Parameters:
filename (str) – the filename to parse.
- Returns:
the parse tree. It is a
lark.Tree
object.- Return type:
Tree
- parse_expression(s, domain, state=None, variables=None, auto_constant_guess=True)[source]#
Parse a PDSketch v3 expression string.
- Parameters:
- Returns:
the parsed expression.
- Return type:
- parse_str(s)[source]#
Parse a PDSketch v3 string.
- Parameters:
s (str) – the string to parse.
- Returns:
the parse tree. It is a
lark.Tree
object.- Return type:
Tree
- static transform_expression(tree, domain, state=None, variables=None, auto_constant_guess=True)[source]#
Transform a parse tree into an expression.
- Parameters:
- Returns:
the parsed expression.
- Return type:
- grammar_file = '/Users/jiayuanm/Projects/Concepts/concepts/pdsketch/parsers/pdsketch-v3.grammar'#
The grammar definition v3 for PDSketch.