|
|
|
@ -9,6 +9,7 @@
|
|
|
|
|
|
|
|
|
|
%{
|
|
|
|
|
open Ctl_parser_types
|
|
|
|
|
|
|
|
|
|
%}
|
|
|
|
|
|
|
|
|
|
%token EU
|
|
|
|
@ -20,8 +21,9 @@
|
|
|
|
|
%token EG
|
|
|
|
|
%token AG
|
|
|
|
|
%token EH
|
|
|
|
|
%token ET
|
|
|
|
|
%token DEFINE_CHECKER
|
|
|
|
|
%token ET
|
|
|
|
|
%token WITH_TRANSITION
|
|
|
|
|
%token SET
|
|
|
|
|
%token LET
|
|
|
|
|
%token TRUE
|
|
|
|
@ -36,13 +38,18 @@
|
|
|
|
|
%token AND
|
|
|
|
|
%token OR
|
|
|
|
|
%token NOT
|
|
|
|
|
%token QUOTES
|
|
|
|
|
%token COMMENT
|
|
|
|
|
%token COMMENT_LINE
|
|
|
|
|
%token IMPLIES
|
|
|
|
|
%token <string> IDENTIFIER
|
|
|
|
|
%token <string> STRING
|
|
|
|
|
%token EOF
|
|
|
|
|
|
|
|
|
|
/* associativity and priority (lower to higher) of operators */
|
|
|
|
|
%nonassoc IMPLIES
|
|
|
|
|
%left OR
|
|
|
|
|
%left AND
|
|
|
|
|
%left AU, EU
|
|
|
|
|
%right NOT, AX, EX, AF, EF, EG, AG, EH
|
|
|
|
|
|
|
|
|
|
%start <Ctl_parser_types.ctl_checker list> checkers_list
|
|
|
|
|
|
|
|
|
|
%%
|
|
|
|
@ -53,7 +60,7 @@ checkers_list:
|
|
|
|
|
|
|
|
|
|
checker:
|
|
|
|
|
DEFINE_CHECKER IDENTIFIER ASSIGNMENT LEFT_BRACE clause_list RIGHT_BRACE
|
|
|
|
|
{ Logging.out "Parsed checker \n"; { name = $2; definitions = $5 } }
|
|
|
|
|
{ Logging.out "Parsed checker \n\n"; { name = $2; definitions = $5 } }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
clause_list:
|
|
|
|
@ -63,22 +70,22 @@ clause_list:
|
|
|
|
|
|
|
|
|
|
clause:
|
|
|
|
|
| SET IDENTIFIER ASSIGNMENT formula
|
|
|
|
|
{ Logging.out "Parsed set clause\n"; CSet ($2, $4) }
|
|
|
|
|
{ Logging.out "\tParsed set clause\n"; CSet ($2, $4) }
|
|
|
|
|
| SET IDENTIFIER ASSIGNMENT STRING
|
|
|
|
|
{ Logging.out "Parsed desc clause\n"; CDesc ($2, $4) }
|
|
|
|
|
{ Logging.out "\tParsed desc clause\n"; CDesc ($2, $4) }
|
|
|
|
|
| LET IDENTIFIER ASSIGNMENT formula
|
|
|
|
|
{ Logging.out "Parsed let clause\n"; CLet ($2, $4) }
|
|
|
|
|
{ Logging.out "\tParsed let clause\n"; CLet ($2, $4) }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
atomic_formula:
|
|
|
|
|
| TRUE { Logging.out "Parsed True\n"; CTL.True }
|
|
|
|
|
| FALSE { Logging.out "Parsed False\n"; CTL.False }
|
|
|
|
|
| TRUE { Logging.out "\tParsed True\n"; CTL.True }
|
|
|
|
|
| FALSE { Logging.out "\tParsed False\n"; CTL.False }
|
|
|
|
|
| IDENTIFIER LEFT_PAREN params RIGHT_PAREN
|
|
|
|
|
{ Logging.out "Parsed predicate\n"; CTL.Atomic($1, $3) }
|
|
|
|
|
{ Logging.out "\tParsed predicate\n"; CTL.Atomic($1, $3) }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
formula_id:
|
|
|
|
|
| IDENTIFIER { CTL.Atomic($1,[]) }
|
|
|
|
|
| IDENTIFIER { Logging.out "\tParsed formula identifier '%s' \n" $1; CTL.Atomic($1,[]) }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
params:
|
|
|
|
@ -87,22 +94,36 @@ params:
|
|
|
|
|
| IDENTIFIER COMMA params { $1 :: $3 }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
transition_label:
|
|
|
|
|
| IDENTIFIER { match $1 with
|
|
|
|
|
| "Body" | "body" -> Some CTL.Body
|
|
|
|
|
| "InitExpr" | "initexpr" -> Some CTL.InitExpr
|
|
|
|
|
| _ -> None }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
formula_EF:
|
|
|
|
|
| LEFT_PAREN formula RIGHT_PAREN EF { $2 }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
formula:
|
|
|
|
|
| LEFT_PAREN formula RIGHT_PAREN { $2 }
|
|
|
|
|
| formula_id { Logging.out "Parsed formula identifier\n"; $1 }
|
|
|
|
|
| atomic_formula { Logging.out "Parsed atomic formula\n"; $1 }
|
|
|
|
|
| formula EU formula { Logging.out "Parsed EU\n"; CTL.EU($1, $3) }
|
|
|
|
|
| formula AU formula { Logging.out "Parsed AU\n"; CTL.AU($1, $3) }
|
|
|
|
|
| formula EF { Logging.out "Parsed EF\n"; CTL.EF($1) }
|
|
|
|
|
| formula AF{ Logging.out "Parsed AF\n"; CTL.AF($1) }
|
|
|
|
|
| formula EX { Logging.out "Parsed EX\n"; CTL.EX($1) }
|
|
|
|
|
| formula AX { Logging.out "Parsed AX\n"; CTL.AX($1) }
|
|
|
|
|
| formula EG { Logging.out "Parsed EG\n"; CTL.EG($1) }
|
|
|
|
|
| formula AG { Logging.out "Parsed AG\n"; CTL.AG($1) }
|
|
|
|
|
| formula EH params { Logging.out "Parsed EH\n"; CTL.EH($3, $1) }
|
|
|
|
|
| formula AND formula { Logging.out "Parsed AND\n"; CTL.And($1, $3) }
|
|
|
|
|
| formula OR formula { Logging.out "Parsed OR\n"; CTL.Or($1, $3) }
|
|
|
|
|
| NOT formula { Logging.out "Parsed NOT\n"; CTL.Not($2)}
|
|
|
|
|
| formula_id { $1 }
|
|
|
|
|
| atomic_formula { Logging.out "\tParsed atomic formula\n"; $1 }
|
|
|
|
|
| formula EU formula { Logging.out "\tParsed EU\n"; CTL.EU ($1, $3) }
|
|
|
|
|
| formula AU formula { Logging.out "\tParsed AU\n"; CTL.AU ($1, $3) }
|
|
|
|
|
| formula AF { Logging.out "\tParsed AF\n"; CTL.AF ($1) }
|
|
|
|
|
| formula EX { Logging.out "\tParsed EX\n"; CTL.EX ($1) }
|
|
|
|
|
| formula AX { Logging.out "\tParsed AX\n"; CTL.AX ($1) }
|
|
|
|
|
| formula EG { Logging.out "\tParsed EG\n"; CTL.EG ($1) }
|
|
|
|
|
| formula AG { Logging.out "\tParsed AG\n"; CTL.AG ($1) }
|
|
|
|
|
| formula EH params { Logging.out "\tParsed EH\n"; CTL.EH ($3, $1) }
|
|
|
|
|
| formula EF { Logging.out "\tParsed EF\n"; CTL.EF ($1) }
|
|
|
|
|
| ET params WITH_TRANSITION transition_label formula_EF
|
|
|
|
|
{ Logging.out "\tParsed ET\n"; CTL.ET ($2, $4, $5)}
|
|
|
|
|
| formula AND formula { Logging.out "\tParsed AND\n"; CTL.And ($1, $3) }
|
|
|
|
|
| formula OR formula { Logging.out "\tParsed OR\n"; CTL.Or ($1, $3) }
|
|
|
|
|
| formula IMPLIES formula { Logging.out "\tParsed IMPLIES\n"; CTL.Implies ($1, $3) }
|
|
|
|
|
| NOT formula { Logging.out "\tParsed NOT\n"; CTL.Not ($2) }
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
%%
|
|
|
|
|