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 541d123b authored by Hogan's avatar Hogan

Removed Lambda statements

parent c46d9a02
......@@ -32,12 +32,6 @@ COMMENT ";".*
beginScope();
return T_LETSTAR;
}
"lambda" {
beginScope();
return T_LAMBDA;
}
"input" {
return T_INPUT;
}
......@@ -159,4 +153,4 @@ COMMENT ";".*
. {
return T_UNKNOWN;
}
%%
\ No newline at end of file
%%
......@@ -44,7 +44,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_IF T_LETSTAR T_PRINT T_INPUT T_PROGN T_EXIT
%token T_ADD T_SUB T_MULT T_DIV
%token T_LT T_GT T_LE T_GE T_EQ T_NE T_AND T_OR T_NOT
%token T_INTCONST T_STRCONST T_T T_NIL T_IDENT T_UNKNOWN
......@@ -56,7 +56,7 @@ extern "C"
%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_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
/*
......@@ -179,12 +179,6 @@ N_PARENTHESIZED_EXPR : N_ARITHLOGIC_EXPR
$$.numParams=$1.numParams;
$$.returnType=$1.returnType;
}
| N_LAMBDA_EXPR
{
$$.type=$1.type;
$$.numParams=$1.numParams;
$$.returnType=$1.returnType;
}
| N_PRINT_EXPR
{
$$.type=$1.type;
......@@ -229,18 +223,6 @@ N_PROGN_OR_USERFUNCTCALL : N_FUNCT_NAME N_ACTUAL_PARAMS
$$.numParams = $2.numParams;
$$.returnType = UNDEFINED;
}
| T_LPAREN N_LAMBDA_EXPR T_RPAREN N_ACTUAL_PARAMS
{
if($2.numParams < $4.numParams){
yyerror("Too many parameters in function call");
} else if($4.numParams < $2.numParams){
yyerror("Too few parameters in function call");
}
$$.type = $2.returnType;
$$.numParams = $4.numParams;
$$.returnType = $2.returnType;
}
;
N_ACTUAL_PARAMS : N_EXPR_LIST
{
......@@ -394,37 +376,6 @@ N_ID_EXPR_LIST : /* epsilon */
scopeStack.top().addEntry(SYMBOL_TABLE_ENTRY(lexeme, $4));
}
;
N_LAMBDA_EXPR : T_LAMBDA T_LPAREN N_ID_LIST T_RPAREN N_EXPR
{
if($5.type==FUNCTION){
yyerror("Arg 2 cannot be a function");
}
endScope();
$$.type=FUNCTION;
$$.numParams=$3.numParams;
$$.returnType=$5.type;
}
;
N_ID_LIST : /* epsilon */
{
$$.numParams = 0;
}
| N_ID_LIST T_IDENT
{
string lexeme = string($2);
printf("___Adding %s to symbol table\n", $2);
bool found = scopeStack.top().findEntry(lexeme);
if(found){
yyerror("Multiply defined identifier");
}
scopeStack.top().addEntry(SYMBOL_TABLE_ENTRY(lexeme, INT_OR_STR_OR_BOOL));
$$.type = INT;
$$.numParams = $1.numParams+1;
$$.returnType = NOT_APPLICABLE;
}
;
N_PRINT_EXPR : T_PRINT N_EXPR
{
if($2.type==FUNCTION){
......
No preview for this file type
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