|
|
@ -9,6 +9,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
%{
|
|
|
|
%{
|
|
|
|
open Ctl_parser_types
|
|
|
|
open Ctl_parser_types
|
|
|
|
|
|
|
|
|
|
|
|
%}
|
|
|
|
%}
|
|
|
|
|
|
|
|
|
|
|
|
%token EU
|
|
|
|
%token EU
|
|
|
@ -20,8 +21,9 @@
|
|
|
|
%token EG
|
|
|
|
%token EG
|
|
|
|
%token AG
|
|
|
|
%token AG
|
|
|
|
%token EH
|
|
|
|
%token EH
|
|
|
|
%token ET
|
|
|
|
|
|
|
|
%token DEFINE_CHECKER
|
|
|
|
%token DEFINE_CHECKER
|
|
|
|
|
|
|
|
%token ET
|
|
|
|
|
|
|
|
%token WITH_TRANSITION
|
|
|
|
%token SET
|
|
|
|
%token SET
|
|
|
|
%token LET
|
|
|
|
%token LET
|
|
|
|
%token TRUE
|
|
|
|
%token TRUE
|
|
|
@ -36,13 +38,18 @@
|
|
|
|
%token AND
|
|
|
|
%token AND
|
|
|
|
%token OR
|
|
|
|
%token OR
|
|
|
|
%token NOT
|
|
|
|
%token NOT
|
|
|
|
%token QUOTES
|
|
|
|
%token IMPLIES
|
|
|
|
%token COMMENT
|
|
|
|
|
|
|
|
%token COMMENT_LINE
|
|
|
|
|
|
|
|
%token <string> IDENTIFIER
|
|
|
|
%token <string> IDENTIFIER
|
|
|
|
%token <string> STRING
|
|
|
|
%token <string> STRING
|
|
|
|
%token EOF
|
|
|
|
%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
|
|
|
|
%start <Ctl_parser_types.ctl_checker list> checkers_list
|
|
|
|
|
|
|
|
|
|
|
|
%%
|
|
|
|
%%
|
|
|
@ -53,7 +60,7 @@ checkers_list:
|
|
|
|
|
|
|
|
|
|
|
|
checker:
|
|
|
|
checker:
|
|
|
|
DEFINE_CHECKER IDENTIFIER ASSIGNMENT LEFT_BRACE clause_list RIGHT_BRACE
|
|
|
|
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:
|
|
|
|
clause_list:
|
|
|
@ -63,22 +70,22 @@ clause_list:
|
|
|
|
|
|
|
|
|
|
|
|
clause:
|
|
|
|
clause:
|
|
|
|
| SET IDENTIFIER ASSIGNMENT formula
|
|
|
|
| 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
|
|
|
|
| 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
|
|
|
|
| LET IDENTIFIER ASSIGNMENT formula
|
|
|
|
{ Logging.out "Parsed let clause\n"; CLet ($2, $4) }
|
|
|
|
{ Logging.out "\tParsed let clause\n"; CLet ($2, $4) }
|
|
|
|
;
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
atomic_formula:
|
|
|
|
atomic_formula:
|
|
|
|
| TRUE { Logging.out "Parsed True\n"; CTL.True }
|
|
|
|
| TRUE { Logging.out "\tParsed True\n"; CTL.True }
|
|
|
|
| FALSE { Logging.out "Parsed False\n"; CTL.False }
|
|
|
|
| FALSE { Logging.out "\tParsed False\n"; CTL.False }
|
|
|
|
| IDENTIFIER LEFT_PAREN params RIGHT_PAREN
|
|
|
|
| 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:
|
|
|
|
formula_id:
|
|
|
|
| IDENTIFIER { CTL.Atomic($1,[]) }
|
|
|
|
| IDENTIFIER { Logging.out "\tParsed formula identifier '%s' \n" $1; CTL.Atomic($1,[]) }
|
|
|
|
;
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
params:
|
|
|
|
params:
|
|
|
@ -87,22 +94,36 @@ params:
|
|
|
|
| IDENTIFIER COMMA params { $1 :: $3 }
|
|
|
|
| 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:
|
|
|
|
formula:
|
|
|
|
| LEFT_PAREN formula RIGHT_PAREN { $2 }
|
|
|
|
| LEFT_PAREN formula RIGHT_PAREN { $2 }
|
|
|
|
| formula_id { Logging.out "Parsed formula identifier\n"; $1 }
|
|
|
|
| formula_id { $1 }
|
|
|
|
| atomic_formula { Logging.out "Parsed atomic formula\n"; $1 }
|
|
|
|
| atomic_formula { Logging.out "\tParsed atomic formula\n"; $1 }
|
|
|
|
| formula EU formula { Logging.out "Parsed EU\n"; CTL.EU($1, $3) }
|
|
|
|
| formula EU formula { Logging.out "\tParsed EU\n"; CTL.EU ($1, $3) }
|
|
|
|
| formula AU formula { Logging.out "Parsed AU\n"; CTL.AU($1, $3) }
|
|
|
|
| formula AU formula { Logging.out "\tParsed AU\n"; CTL.AU ($1, $3) }
|
|
|
|
| formula EF { Logging.out "Parsed EF\n"; CTL.EF($1) }
|
|
|
|
| formula AF { Logging.out "\tParsed AF\n"; CTL.AF ($1) }
|
|
|
|
| formula AF{ Logging.out "Parsed AF\n"; CTL.AF($1) }
|
|
|
|
| formula EX { Logging.out "\tParsed EX\n"; CTL.EX ($1) }
|
|
|
|
| formula EX { Logging.out "Parsed EX\n"; CTL.EX($1) }
|
|
|
|
| formula AX { Logging.out "\tParsed AX\n"; CTL.AX ($1) }
|
|
|
|
| formula AX { Logging.out "Parsed AX\n"; CTL.AX($1) }
|
|
|
|
| formula EG { Logging.out "\tParsed EG\n"; CTL.EG ($1) }
|
|
|
|
| formula EG { Logging.out "Parsed EG\n"; CTL.EG($1) }
|
|
|
|
| formula AG { Logging.out "\tParsed AG\n"; CTL.AG ($1) }
|
|
|
|
| formula AG { Logging.out "Parsed AG\n"; CTL.AG($1) }
|
|
|
|
| formula EH params { Logging.out "\tParsed EH\n"; CTL.EH ($3, $1) }
|
|
|
|
| formula EH params { Logging.out "Parsed EH\n"; CTL.EH($3, $1) }
|
|
|
|
| formula EF { Logging.out "\tParsed EF\n"; CTL.EF ($1) }
|
|
|
|
| formula AND formula { Logging.out "Parsed AND\n"; CTL.And($1, $3) }
|
|
|
|
| ET params WITH_TRANSITION transition_label formula_EF
|
|
|
|
| formula OR formula { Logging.out "Parsed OR\n"; CTL.Or($1, $3) }
|
|
|
|
{ Logging.out "\tParsed ET\n"; CTL.ET ($2, $4, $5)}
|
|
|
|
| NOT formula { Logging.out "Parsed NOT\n"; CTL.Not($2)}
|
|
|
|
| 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) }
|
|
|
|
;
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
%%
|
|
|
|
%%
|
|
|
|