This server is intended for use for Academic Classwork related Git repositories only. Projects/repositories will generally be removed after 6 months following close of the semester. Inactive repositories from previous semester are now being archived when no activity for 365 days. They are renamed and marked as 'archived'. After 90 days in that state they will be removed from the system completely.

Commit 23d0dac3 authored by jdev52's avatar jdev52

fixed various typing bugs

parent c37e8e63
......@@ -45,7 +45,7 @@ extern "C"
/*
* Token declarations
*/
*/
%token T_LPAREN T_RPAREN
%token T_IF T_LETSTAR T_LAMBDA T_PRINT T_INPUT T_PROGN T_EXIT
%token T_ADD T_SUB T_MULT T_DIV
......@@ -53,7 +53,11 @@ extern "C"
%token T_INTCONST T_STRCONST T_T T_NIL T_IDENT T_UNKNOWN
%type <text> T_IDENT
%type <typeInfo> N_CONST N_EXPR N_PARENTHESIZED_EXPR N_IF_EXPR
%type <typeInfo> N_START N_EXPR N_CONST N_PARENTHESIZED_EXPR
%type <typeInfo> N_PROGN_OR_USERFUNCTCALL N_ACTUAL_PARAMS N_FUNCT_NAME
%type <typeInfo> N_ARITHLOGIC_EXPR N_IF_EXPR N_LET_EXPR N_ID_EXPR_LIST
%type <typeInfo> N_LAMBDA_EXPR N_ID_LIST N_PRINT_EXPR N_INPUT_EXPR
%type <typeInfo> N_EXPR_LIST N_BIN_OP N_ARITH_OP N_REL_OP N_LOG_OP N_UN_OP
/*
* Starting point.
*/
......@@ -68,7 +72,7 @@ N_START : // epsilon
}
| N_START N_EXPR
{
switch type:
switch ($2.type):
case 1:
cout<<"INT"<<"\n";
case 2:
......@@ -243,9 +247,9 @@ N_IF_EXPR : T_IF N_EXPR N_EXPR N_EXPR
N_LET_EXPR
: T_LETSTAR T_LPAREN N_ID_EXPR_LIST T_RPAREN N_EXPR
{
if($5.type==FUNCTION)
yyerror("Arg 1 cannot be function");
$$.type=$5.type;
if($5.type==FUNCTION)
yyerror("Arg 1 cannot be function");
$$.type=$5.type;
endScope();
}
;
......@@ -256,14 +260,14 @@ N_ID_EXPR_LIST : /* epsilon */
| N_ID_EXPR_LIST T_LPAREN T_IDENT N_EXPR T_RPAREN
{
string lexeme = string($3);
printf("___Adding %s to symbol table\n", $3);
bool success = scopeStack.top().addEntry
(SYMBOL_TABLE_ENTRY(lexeme,
UNDEFINED));
if (! success)
yyerror("Multiply defined identifier");
$4.type=$5.type;
string lexeme = string($3);
printf("___Adding %s to symbol table\n", $3);
bool success = scopeStack.top().addEntry
(SYMBOL_TABLE_ENTRY(lexeme,
UNDEFINED));
if (! success)
yyerror("Multiply defined identifier");
$3.type=$4.type;
}
;
......@@ -289,7 +293,7 @@ N_ID_LIST : /* epsilon */
bool success = scopeStack.top().addEntry(SYMBOL_TABLE_ENTRY(lexeme,UNDEFINED));
if (! success)
yyerror("Multiply defined identifier");
$2.type=INT_STR_OR_BOOL;
$2.type=INT_OR_STR_OR_BOOL;
}
;
N_PRINT_EXPR : T_PRINT N_EXPR
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment