Skip to content

Commit

Permalink
added the working set to the grammar
Browse files Browse the repository at this point in the history
  • Loading branch information
reb-ddm committed Feb 13, 2025
1 parent a3af8f4 commit c2f374a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions core/grammar/kappaParser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ start_rule:
| instruction newline
{ fun c -> let r = $2 c in
match $1 with
| Ast.RULE ru ->
{r with Ast.rules = ru::r.Ast.rules}
| Ast.RULE (label, guard, rule, _) ->
{r with Ast.rules = (label, guard, rule)::r.Ast.rules}
| Ast.SIG ag ->
{r with Ast.signatures=ag::r.Ast.signatures}
| Ast.TOKENSIG (str_pos) ->
Expand Down
11 changes: 9 additions & 2 deletions core/grammar/kparser4.mly
Original file line number Diff line number Diff line change
Expand Up @@ -802,12 +802,19 @@ perturbation_declaration:
($1,None,e,post) }
;

working_set:
| LABEL annoted rule working_set
{ add (let guard, rule = $3 in Ast.RULE(Some ($1, rhs_pos 1),guard, rule, true)) }
| rule working_set { let guard,rule = $1 in add (Ast.RULE (None, guard, rule, true)) }
| { }

sentence:
| LABEL annoted rule
{ add (let guard, rule = $3 in Ast.RULE(Some ($1, rhs_pos 1),guard, rule)) }
{ add (let guard, rule = $3 in Ast.RULE(Some ($1, rhs_pos 1),guard, rule, false)) }
| LABEL annoted EQUAL annoted alg_expr
{ let (v,_,_) = $5 in add (Ast.DECLARE (($1,rhs_pos 1),v)) }
| rule { let guard,rule = $1 in add (Ast.RULE (None, guard, rule)) }
| rule { let guard,rule = $1 in add (Ast.RULE (None, guard, rule, false)) }
| WORKING_SET annoted OP_BRA annoted working_set CL_BRA annoted {}
| SIGNATURE annoted agent_sig { let (a,_,_) = $3 in add (Ast.SIG a) }
| SIGNATURE annoted error
{ raise
Expand Down

0 comments on commit c2f374a

Please sign in to comment.