/* rfpllgr.g */ /* This file contains the LL(1) grammar that is actually used in */ /* the Refal Plus compiler written by R.F.Gurin & S.A.Romanenko. */ /* The annotated version of this grammar (contained in the file */ /* "rfpllgr.f") was produced by executing the command: */ /* gr.exe rfpllgr.g >rfpllgr.f */ %token SC COMMA %token LPAR RPAR LANGU RANGU %token LCURL RCURL %token OBJ_DECL FUNC_DECL MATCH_DIR %token CONST FAIL ITER %token TRAP WITH %token COL COL_CURL LET NOT EQL REF %token USE %token FENCE CUT ERROR %token TRACE_ALL %token CHAR WORD NUMB %token VAR %token INTERFACE IMPLEMENTATION %% program : INTERFACE interf | IMPLEMENTATION implem ; interf : decls ; implem : imports directives ; imports : /* empty */ | import imports ; import : USE module_names SC ; module_names : /* empty */ | name module_names ; decls : /* empty */ | decl SC decls ; directives : /* empty */ | directive SC directives ; directive : decl | func_def | trace_all ; trace_all : TRACE_ALL ; decl : obj_decl | const_decl | func_decl ; obj_decl : OBJ_DECL obj_names ; obj_names : /* empty */ | name obj_names ; const_decl : CONST const_bindings ; const_bindings : /* empty */ | const_binding const_bindings_tail ; const_bindings_tail : /* empty */ | COMMA const_binding const_bindings_tail ; const_binding : name EQL const_exp ; func_decl : FUNC_DECL name format_exp EQL format_exp ; func_def : name func_body ; func_body : pattern_alt | sentence ; pattern_alt : LCURL sentences RCURL ; sentences : /* empty */ | sentence SC sentences ; sentence : pattern o_rest ; path : source path_tail ; path_tail : /* empty */ | rest | LET hard_exp o_rest | ITER source iter_tail | COL sentence ; iter_tail : LET hard_exp o_rest | o_rest ; o_rest : /* empty */ | rest ; rest : COMMA path | FENCE path | CUT path | ERROR path | EQL path | NOT source o_rest | FAIL | TRAP path WITH pattern_alt ; source : alt source_tail | result_exp source_tail ; source_tail : /* empty */ | COL_CURL pattern_alt source_tail ; alt : LCURL paths RCURL ; paths : /* empty */ | path SC paths ; pattern : match_direction pattern_exp ; match_direction : /* empty */ | MATCH_DIR ; pattern_exp : /* empty */ | pattern_exp_head pattern_exp ; pattern_exp_head : REF name | static_symbol | LPAR pattern_exp RPAR | VAR ; hard_exp : pattern_exp ; format_exp : pattern_exp ; result_exp : /* empty */ | result_exp_head result_exp ; result_exp_head : REF name | static_symbol | LPAR result_exp RPAR | VAR | LANGU name result_exp RANGU ; name : WORD ; const_exp : /* empty */ | const_exp_head const_exp ; const_exp_head : REF name | static_symbol | LPAR const_exp RPAR ; static_symbol : CHAR | WORD | NUMB ;