Project

General

Profile

Grammaire (à partir du parseur OCaml)

prog : typ_def_list top_decl_list EOF

top_decl_list : top_decl
              | top_decl_list top_decl

top_decl :
         | CONST cdecl_list
         | NODE IDENT LPAR vdecl_list RPAR RETURNS LPAR vdecl_list SCOL_opt RPAR SCOL_opt locals LET eq_list TEL
         | IMPORTED NODE IDENT LPAR vdecl_list RPAR RETURNS LPAR vdecl_list RPAR SCOL
         | INCLUDE QUOTE IDENT QUOTE

typ_def_list :
             | typ_def SCOL typ_def_list

typ_def : TYPE IDENT EQ IDENT
        | TYPE IDENT EQ TINT
        | TYPE IDENT EQ TBOOL
        | TYPE IDENT EQ TREAL
        | TYPE IDENT EQ TFLOAT

eq_list : eq
        | eq_list eq

eq : ident_list  EQ expr SCOL
   | LPAR ident_list RPAR EQ expr SCOL

tuple_expr : expr COMMA expr
           | tuple_expr COMMA expr

expr : const
     | IDENT
     | LPAR expr RPAR
     | LPAR tuple_expr RPAR
     | expr ARROW expr
     | const FBY expr
     | const COLCOL expr
     | expr WHEN IDENT
     | expr WHENNOT IDENT
     | MERGE LPAR IDENT COMMA expr COMMA expr RPAR
     | IDENT LPAR expr RPAR
     | IDENT LPAR expr RPAR EVERY IDENT
     | IDENT LPAR tuple_expr RPAR
     | IDENT LPAR tuple_expr RPAR EVERY IDENT
/* Boolean expr */
     | expr AND expr
     | expr AMPERAMPER expr
     | expr OR expr
     | expr BARBAR expr
     | expr XOR expr
     | NOT expr
     | expr IMPL expr
/* Comparison expr */
     | expr EQ expr
     | expr LT expr
     | expr LTE expr
     | expr GT expr
     | expr GTE  expr
     | expr NEQ expr
/* Arithmetic expr */
     | expr PLUS expr
     | expr MINUS expr
     | expr MULT expr
     | expr DIV expr
     | MINUS expr          
     | expr MOD expr
/* Temp op */
     | PRE expr
/* If */
     | IF expr THEN expr ELSE expr

const : INT
      | REAL
      | FLOAT
      | TRUE
      | FALSE

locals :
       | VAR vdecl_list SCOL

vdecl_list : vdecl
           | vdecl_list SCOL vdecl

vdecl : ident_list
      | ident_list COL typ clock

cdecl_list : cdecl SCOL
           | cdecl SCOL cdecl_list

cdecl : IDENT EQ const

clock :
      | when_list

when_cond : WHEN IDENT
          | WHENNOT IDENT

when_list : when_cond
          | when_list when_cond

typ :
    | TINT
    | IDENT
    | TFLOAT
    | TREAL
    | TBOOL
    | TCLOCK

ident_list : IDENT
           | ident_list COMMA IDENT

SCOL_opt :
         | SCOL