Skip to content

Commit

Permalink
Merge pull request #4 from krr-up/astpred-metaclass
Browse files Browse the repository at this point in the history
Implement reification and reflection for full gringo imput language.
  • Loading branch information
namcsi committed Sep 22, 2023
2 parents 9824984 + 6e59147 commit 2af0045
Show file tree
Hide file tree
Showing 128 changed files with 1,931 additions and 2,004 deletions.
1 change: 1 addition & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ argument-rgx=^[a-z][a-z0-9]*((_[a-z0-9]+)*_?)?$
variable-rgx=^[a-z][a-z0-9]*((_[a-z0-9]+)*_?)?$
class-naming-style=any
class-const-naming-style=PascalCase
disable: E1101

# Good variable names which should always be accepted, separated by a comma.
good-names=_,M,N,B,A,Nn,Bn,An
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ build-backend = "setuptools.build_meta"
[tool.black]
skip_magic_trailing_comma = true
line-length = 88

[tool.mypy]
disable_error_code = ["attr-defined"]
23 changes: 19 additions & 4 deletions src/renopro/asp/ast.lp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ast(binary_operation(Id,Operator,Left,Right)) :- binary_operation(Id,Operator,Le
ast(interval(Id,Left,Right)) :- interval(Id,Left,Right).
ast(terms(Id,Pos,Element)) :- terms(Id,Pos,Element).
ast(function(Id,Name,Args)) :- function(Id,Name,Args).
ast(external_function(Id,Name,Args)) :- external_function(Id,Name,Args).
ast(pool(Id,Args)) :- pool(Id,Args).
ast(theory_terms(Id,Pos,Element)) :- theory_terms(Id,Pos,Element).
ast(theory_sequence(Id,SeqType,Terms)) :- theory_sequence(Id,SeqType,Terms).
Expand All @@ -22,22 +23,36 @@ ast(symbolic_atom(Id,Symbol)) :- symbolic_atom(Id,Symbol).
ast(literal(Id,Sign,Atom)) :- literal(Id,Sign,Atom).
ast(literals(Id,Pos,Element)) :- literals(Id,Pos,Element).
ast(conditional_literal(Id,Literal,Condition)) :- conditional_literal(Id,Literal,Condition).
ast(agg_elements(Id,Pos,Element)) :- agg_elements(Id,Pos,Element).
ast(aggregate_elements(Id,Pos,Element)) :- aggregate_elements(Id,Pos,Element).
ast(aggregate(Id,LGuard,Elements,RGuard)) :- aggregate(Id,LGuard,Elements,RGuard).
ast(theory_atom_elements(Id,Pos,TheoryTerms,Condition)) :- theory_atom_elements(Id,Pos,TheoryTerms,Condition).
ast(theory_guard(Id,OpName,Term)) :- theory_guard(Id,OpName,Term).
ast(theory_atom(Id,Atom,Elements,TheoryGuard)) :- theory_atom(Id,Atom,Elements,TheoryGuard).
ast(body_agg_elements(Id,Pos,Terms,Condition)) :- body_agg_elements(Id,Pos,Terms,Condition).
ast(body_aggregate_elements(Id,Pos,Terms,Condition)) :- body_aggregate_elements(Id,Pos,Terms,Condition).
ast(body_aggregate(Id,LGuard,Elements,RGuard)) :- body_aggregate(Id,LGuard,Elements,RGuard).
ast(body_literal(Id,Sign,Atom)) :- body_literal(Id,Sign,Atom).
ast(body_literals(Id,Pos,Element)) :- body_literals(Id,Pos,Element).
ast(head_agg_elements(Id,Pos,Terms,Condition)) :- head_agg_elements(Id,Pos,Terms,Condition).
ast(head_aggregate_elements(Id,Pos,Terms,Condition)) :- head_aggregate_elements(Id,Pos,Terms,Condition).
ast(head_aggregate(Id,LGuard,Elements,RGuard)) :- head_aggregate(Id,LGuard,Elements,RGuard).
ast(conditional_literals(Id,Pos,CondLit)) :- conditional_literals(Id,Pos,CondLit).
ast(disjunction(Id,Pos,Element)) :- disjunction(Id,Pos,Element).
ast(rule(Id,Head,Body)) :- rule(Id,Head,Body).
ast(definition(Id,Name,Value,Default)) :- definition(Id,Name,Value,Default).
ast(show_signature(Id,Name,Arity,Positive)) :- show_signature(Id,Name,Arity,Positive).
ast(defined(Id,Name,Arity,Positive)) :- defined(Id,Name,Arity,Positive).
ast(minimize(Id,Weight,Priority,Terms,Body)) :- minimize(Id,Weight,Priority,Terms,Body).
ast(script(Id,Name,Code)) :- script(Id,Name,Code).
ast(statements(Id,Pos,Element)) :- statements(Id,Pos,Element).
ast(constants(Id,Pos,Element)) :- constants(Id,Pos,Element).
ast(program(Name,Params,Statements)) :- program(Name,Params,Statements).
ast(program(Id,Name,Params,Statements)) :- program(Id,Name,Params,Statements).
ast(external(Atom,Body,Type)) :- external(Atom,Body,Type).
ast(edge(Id,U,V,Body)) :-edge(Id,U,V,Body).
ast(heuristic(Id,Atom,Body,Bias,Priority,Modifier)) :- heuristic(Id,Atom,Body,Bias,Priority,Modifier).
ast(project_atom(Id,Atom,Body)) :- project_atom(Id,Atom,Body).
ast(project_signature(Id,Name,Arity,Positive)) :- project_signature(Id,Name,Arity,Positive).
ast(theory_operator_definitions(Id,Pos,Name,Priority,OpType)) :- theory_operator_definitions(Id,Pos,Name,Priority,OpType).
ast(theory_term_definitions(Id,Pos,Name,Operators)) :- theory_term_definitions(Id,Pos,Name,Operators).
ast(theory_guard_definition(Id,Operators,Term)) :- theory_guard_definition(Id,Operators,Term).
ast(theory_atom_definitions(Id,Pos,AtomType,Name,Arity,Term,Guard)) :- theory_atom_definitions(Id,Pos,AtomType,Name,Arity,Term,Guard).
ast(theory_definition(Id,Name,Terms,Atoms)) :- theory_definition(Id,Name,Terms,Atoms).

22 changes: 18 additions & 4 deletions src/renopro/asp/defined.lp
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,35 @@
#defined literal/3.
#defined literals/3.
#defined conditional_literal/3.
#defined agg_elements/3.
#defined aggregate_elements/3.
#defined aggregate/4.
#defined theory_atom_elements/4.
#defined theory_guard/3.
#defined theory_atom/4.
#defined body_agg_elements/4.
#defined body_aggregate_elements/4.
#defined body_aggregate/4.
#defined body_literal/3.
#defined body_literals/3.
#defined head_agg_elements/4.
#defined head_aggregate_elements/4.
#defined head_aggregate/4.
#defined conditional_literals/3.
#defined disjunction/3.
#defined rule/3.
#defined definition/4.
#defined show_signature/4.
#defined defined/4.
#defined minimize/5.
#defined script/3.
#defined statements/3.
#defined constants/3.
#defined program/3.
#defined program/4.
#defined external/3.
#defined edge/4.
#defined heuristic/6.
#defined project_atom/3.
#defined project_signature/4.
#defined theory_operator_definitions/5.
#defined theory_term_definitions/5.
#defined theory_guard_definition/3.
#defined theory_atom_definitions/7.
#defined theory_definition/4.
6 changes: 3 additions & 3 deletions src/renopro/asp/viz.lp
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ edge((literals(Id),Element)) :- literals(Id,Pos,Element).
attr(edge,(literals(Id),Element),label,pos) :- literals(Id,Pos,Element).

% node(conditional_literal(Id)) :- conditional_literal(Id,Literal,Condition).
% node(agg_elements(Id)) :- agg_elements(Id,Pos,Element).
% node(aggregate_elements(Id)) :- aggregate_elements(Id,Pos,Element).
% node(aggregate(Id)) :- aggregate(Id,LGuard,Elements,RGuard).
% node(body_agg_elements(Id)) :- body_agg_elements(Id,Pos,Terms,Condition).
% node(body_aggregate_elements(Id)) :- body_aggregate_elements(Id,Pos,Terms,Condition).
% node(body_aggregate(Id)) :- body_aggregate(Id,LGuard,Elements,RGuard).

node(body_literal(Id)) :- body_literal(Id,Sign,Atom).
Expand All @@ -93,7 +93,7 @@ edge((body_literals(Id),Element)) :- body_literals(Id,Pos,Element).
attr(edge,(body_literals(Id),Element),label,Pos) :- body_literals(Id,Pos,Element).


% node(head_agg_elements(Id)) :- head_agg_elements(Id,Pos,Terms,Condition).
% node(head_aggregate_elements(Id)) :- head_aggregate_elements(Id,Pos,Terms,Condition).
% node(head_aggregate(Id)) :- head_aggregate(Id,LGuard,Elements,RGuard).
% node(disjunction(Id)) :- disjunction(Id,Pos,Element).

Expand Down
Loading

0 comments on commit 2af0045

Please sign in to comment.