more work on the code generation and make generally usable again by disabling

the new stuff
This commit is contained in:
Bill Currie 2001-06-15 07:16:18 +00:00
parent f9baacd440
commit 373ea8132a
3 changed files with 37 additions and 20 deletions

View file

@ -33,5 +33,5 @@ YFLAGS = -d
bin_PROGRAMS= qfcc
qfcc_SOURCES= cmdlib.c pr_comp.c pr_def.c pr_imm.c pr_lex.c pr_opcode.c qfcc.c qc-parse.y qc-lex.l
qfcc_SOURCES= cmdlib.c pr_comp.c pr_def.c pr_imm.c pr_lex.c pr_opcode.c qfcc.c #qc-parse.y qc-lex.l
qfcc_LDADD= -lQFutil

View file

@ -32,16 +32,26 @@ type_t *PR_FindType (type_t *new);
%left '*' '/' '&' '|'
%left '!' '.' '('
%token NAME INT_VAL FLOAT_VAL STRING_VAL VECTOR_VAL QUATERNION_VAL
%token <string_val> NAME STRING_VAL
%token <int_val> INT_VAL
%token <float_val> FLOAT_VAL
%token <vector_val> VECTOR_VAL
%token <quaternion_val> QUATERNION_VAL
%token LOCAL RETURN WHILE DO IF ELSE FOR ELIPSIS
%token <type> TYPE
%type <type> type
%type <def> param param_list def_item def def_list
%type <def> param param_list def_item def_list expr arg_list
%expect 1
%{
type_t *current_type;
%}
%%
defs
@ -50,13 +60,7 @@ defs
;
def
: type def_list
{
def_t *def;
for (def = $2; def; def = def->next)
def->type = $1;
$$ = $2;
}
: type {current_type = $1;} def_list {}
;
type
@ -81,7 +85,11 @@ def_list
;
def_item
: NAME opt_initializer {}
: NAME
{
$$ = PR_GetDef (current_type, $1, pr_scope, pr_scope ? &pr_scope->num_locals : &numpr_globals);
}
opt_initializer
| '(' param_list ')' NAME opt_initializer {}
| '(' ')' NAME opt_initializer {}
| '(' ELIPSIS ')' NAME opt_initializer {}
@ -157,8 +165,11 @@ expr
| '-' expr
| '!' expr
| NAME
| const
| '(' expr ')'
{
$$ = PR_GetDef (NULL, $1, pr_scope, false);
}
| const {}
| '(' expr ')' { $$ = $2; }
;
arg_list
@ -167,11 +178,11 @@ arg_list
;
const
: FLOAT_VAL
| STRING_VAL
| VECTOR_VAL
| QUATERNION_VAL
| INT_VAL
: FLOAT_VAL {}
| STRING_VAL {}
| VECTOR_VAL {}
| QUATERNION_VAL {}
| INT_VAL {}
;
%%

View file

@ -904,6 +904,7 @@ Options: \n\
// compile all the files
while ((src = COM_Parse (src))) {
#if 0
extern FILE *yyin;
int yyparse(void);
extern int lineno;
@ -913,9 +914,7 @@ Options: \n\
sprintf (filename, "%s/%s", sourcedir, com_token);
printf ("compiling %s\n", filename);
LoadFile (filename, (void *) &src2);
//if (!PR_CompileFile (src2, filename))
yyin = fopen (filename, "rt");
lineno = 1;
clear_frame_macros ();
@ -924,6 +923,13 @@ Options: \n\
return 1;
}
fclose (yyin);
#else
sprintf (filename, "%s/%s", sourcedir, com_token);
printf ("compiling %s\n", filename);
LoadFile (filename, (void *) &src2);
if (!PR_CompileFile (src2, filename))
return 1;
#endif
}
if (!PR_FinishCompilation ())