=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/parse/parse.y,v retrieving revision 1.29 retrieving revision 1.35 diff -u -p -r1.29 -r1.35 --- OpenXM_contrib2/asir2000/parse/parse.y 2005/09/13 06:40:46 1.29 +++ OpenXM_contrib2/asir2000/parse/parse.y 2012/12/17 07:20:45 1.35 @@ -45,12 +45,12 @@ * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. * - * $OpenXM: OpenXM_contrib2/asir2000/parse/parse.y,v 1.28 2005/08/24 06:28:39 noro Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/parse/parse.y,v 1.34 2011/06/16 08:17:15 noro Exp $ */ %{ -#define malloc(x) GC_malloc(x) -#define realloc(x,y) GC_realloc(x,y) -#define free(x) GC_free(x) +#define malloc(x) Risa_GC_malloc(x) +#define realloc(x,y) Risa_GC_realloc(x,y) +#define free(x) Risa_GC_free(x) #if defined(TOWNS) #include @@ -92,7 +92,6 @@ extern jmp_buf env; %token STRUCT POINT NEWSTRUCT ANS FDEF PFDEF MODDEF MODEND %token GLOBAL MGLOBAL LOCAL LOCALF CMP OR AND CAR CDR QUOTED COLONCOLON %token DO WHILE FOR IF ELSE BREAK RETURN CONTINUE PARIF MAP RECMAP TIMER GF2NGEN GFPNGEN GFSNGEN GETOPT -%token UNIFY %token FOP_AND FOP_OR FOP_IMPL FOP_REPL FOP_EQUIV FOP_NOT LOP %token

FORMULA UCASE LCASE STR SELF BOPASS %token

'+' '-' '*' '/' '^' '%' @@ -158,23 +157,23 @@ stat : tail | CONTINUE tail { $$ = mksnode(0,S_CONTINUE); } | RETURN tail - { $$ = mksnode(1,S_RETURN,0); } + { $$ = mksnode(1,S_RETURN,NULLP); } | RETURN expr tail { $$ = mksnode(1,S_RETURN,$2); } | IF '(' node ')' stat - { $$ = mksnode(4,S_IFELSE,$1,$3,$5,0); $5?$$->ln=$5->ln:0; NOPR; } + { $$ = mksnode(4,S_IFELSE,$1,$3,$5,NULLP); $5?$$->ln=$5->ln:0; NOPR; } | IF '(' node ')' stat ELSE stat { $$ = mksnode(4,S_IFELSE,$1,$3,$5,$7); $7?$$->ln=$7->ln:0; NOPR; } | FOR '(' node ';' node ';' node ')' stat { $$ = mksnode(5,S_FOR,$1,$3,$5?$5:ONENODE,$7,$9); $9?$$->ln=$9->ln:0; NOPR; } | WHILE '(' node ')' stat - { $$ = mksnode(5,S_FOR,$1,0,$3,0,$5); $5?$$->ln=$5->ln:0; NOPR; } + { $$ = mksnode(5,S_FOR,$1,NULLP,$3,NULLP,$5); $5?$$->ln=$5->ln:0; NOPR; } | DO stat WHILE '(' node ')' tail { $$ = mksnode(3,S_DO,$1,$2,$5); NOPR; } | LCASE '(' node ')' ':' '=' expr tail { $$ = mksnode(3,S_PFDEF,$1,$3,$7); NOPR; } | PFDEF LCASE '(' node ')' tail - { $$ = mksnode(3,S_PFDEF,$2,$4,0); NOPR; } + { $$ = mksnode(3,S_PFDEF,$2,$4,NULLP); NOPR; } | FDEF LCASE { mkpvs($2); } '(' { ldef = 1; } node { ldef = -1; } ')' desc '{' stats '}' { mkuf($2,asir_infile->name,$6, @@ -188,7 +187,7 @@ stat : tail $$ = mksnode(1,S_MODULE,CUR_MODULE); NOPR; } | MODEND tail - { CUR_MODULE = 0; MPVS = 0; $$ = mksnode(1,S_MODULE,0); NOPR; } + { CUR_MODULE = 0; MPVS = 0; $$ = mksnode(1,S_MODULE,NULLP); NOPR; } | error tail { yyerrok; $$ = 0; } ; @@ -266,11 +265,11 @@ pexpr : STR searchf(noargsysf,$1,&f); if ( f ) - $$ = mkfnode(2,I_FUNC,f,0); + $$ = mkfnode(2,I_FUNC,f,NULLP); else { searchc($1,&f); if ( f ) - $$ = mkfnode(2,I_FUNC,f,mkfnode(1,I_LIST,0)); + $$ = mkfnode(2,I_FUNC,f,mkfnode(1,I_LIST,NULLP)); else { gen_searchf_searchonly($1,(FUNC *)&f); if ( f ) @@ -307,14 +306,10 @@ pexpr : STR print_crossref(val); $$ = mkfnode(2,I_RECMAP,val,mkfnode(1,I_LIST,$5)); } - | UNIFY '(' expr ',' expr ')' - { - $$ = mkfnode(2,I_UNIFY,$3,$5); - } | LCASE '{' node '}' '(' node ')' { searchpf($1,(FUNC *)&val); - $$ = mkfnode(2,I_PFDERIV,val,mkfnode(1,I_LIST,$6),mkfnode(1,I_LIST,$3)); + $$ = mkfnode(3,I_PFDERIV,val,mkfnode(1,I_LIST,$6),mkfnode(1,I_LIST,$3)); } | GETOPT '(' rawstr ')' { @@ -322,7 +317,7 @@ pexpr : STR } | GETOPT '(' ')' { - $$ = mkfnode(2,I_GETOPT,0); + $$ = mkfnode(2,I_GETOPT,NULLP); } | TIMER '(' expr ',' expr ',' expr ')' { @@ -333,7 +328,7 @@ pexpr : STR searchf(parif,$3,(FUNC *)&val); if ( !val ) mkparif($3,(FUNC *)&val); - $$ = mkfnode(2,I_FUNC,val,0); + $$ = mkfnode(2,I_FUNC,val,NULLP); } | PARIF '(' LCASE ',' node ')' { @@ -344,19 +339,24 @@ pexpr : STR } | '(' '*' expr ')' '(' node ')' { - $$ = mkfnode(2,I_IFUNC,$3,mkfnode(1,I_LIST,$6)); + $$ = mkfnode(2,I_IFUNC,$3,mkfnode(1,I_LIST,$6),NULLP); } + | '(' '*' expr ')' '(' node '|' optlist ')' + { + $$ = mkfnode(3,I_IFUNC,$3,mkfnode(1,I_LIST,$6), + mkfnode(1,I_LIST,$8)); + } | UCASE '(' node ')' { if ( main_parser || allow_create_var ) - t = mkfnode(2,I_PVAR,makepvar($1),0); + t = mkfnode(2,I_PVAR,makepvar($1),NULLP); else { ind = searchpvar($1); if ( ind == -1 ) { fprintf(stderr,"%s : no such variable.\n",$1); YYABORT; } else - t = mkfnode(2,I_PVAR,ind,0); + t = mkfnode(2,I_PVAR,ind,NULLP); } $$ = mkfnode(2,I_IFUNC,t,mkfnode(1,I_LIST,$3)); } @@ -369,14 +369,14 @@ pexpr : STR | UCASE { if ( main_parser || allow_create_var ) - $$ = mkfnode(2,I_PVAR,makepvar($1),0); + $$ = mkfnode(2,I_PVAR,makepvar($1),NULLP); else { ind = searchpvar($1); if ( ind == -1 ) { fprintf(stderr,"%s : no such variable.\n",$1); YYABORT; } else - $$ = mkfnode(2,I_PVAR,ind,0); + $$ = mkfnode(2,I_PVAR,ind,NULLP); } } | pexpr '[' expr ']' @@ -395,7 +395,7 @@ pexpr : STR expr : pexpr { $$ = $1; } | '(' STRUCT rawstr ')' pexpr - { $$ = mkfnode(3,I_CAST,structtoindex($3),$5,0); } + { $$ = mkfnode(3,I_CAST,structtoindex($3),$5,NULLP); } | expr '=' expr { $$ = mkfnode(2,I_ASSPVAR,$1,$3); } | expr BOPASS expr @@ -431,7 +431,7 @@ expr : pexpr | expr AND expr { $$ = mkfnode(2,I_AND,$1,$3); } | FOP_NOT expr - { $$ = mkfnode(3,I_LOP,$1,$2,0); } + { $$ = mkfnode(3,I_LOP,$1,$2,NULLP); } | expr FOP_AND expr { $$ = mkfnode(3,I_LOP,$2,$1,$3); } | expr FOP_OR expr @@ -452,6 +452,8 @@ expr : pexpr { $$ = mkfnode(1,I_NEWCOMP,(int)structtoindex($3)); } | QUOTED '(' expr ')' { MKQUOTE(quote,$3); $$ = mkfnode(1,I_FORMULA,(pointer)quote); } + | '[' node '|' expr ']' + { $$ = mkfnode(2,I_CONS,$2,$4); } | '`' expr { MKQUOTE(quote,$2); $$ = mkfnode(1,I_FORMULA,(pointer)quote); } ;