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 3a54b5fc authored by Jonathan Evans's avatar Jonathan Evans

implemented all functionality (with bugs)

parent b1223c46
......@@ -105,9 +105,9 @@ N_START : // epsilon
break;
}
*/
cout << "---- Completed parsing ----\n" << endl;
cout << "\nValue of the expression is: ";
cout << $2 <<"\n";
cout << "---- Completed parsing ----\n" << endl;
}
;
N_EXPR : N_CONST
......@@ -234,8 +234,10 @@ N_PROGN_OR_USERFUNCTCALL : N_FUNCT_NAME N_ACTUAL_PARAMS
if($1.type == UNDEFINED){
if($2.type == NOT_APPLICABLE){
$$.type = BOOL;
$$.value.boolean = false;
} else {
$$.type = $2.type;
$$.value = $2.value;
}
} else {
if($1.numParams < $2.numParams){
......@@ -424,7 +426,14 @@ N_IF_EXPR : T_IF N_EXPR N_EXPR N_EXPR
yyerror("Arg 3 cannot be a function");
}
$$.type = $3.type | $4.type;
if($2){
$$.type = $3.type;
$$.value = $3.value;
} else {
$$.type = $4.type;
$$.value = $4.value;
}
$$.numParams = NOT_APPLICABLE;
$$.returnType = NOT_APPLICABLE;
}
......@@ -462,6 +471,9 @@ N_PRINT_EXPR : T_PRINT N_EXPR
yyerror("Arg 1 cannot be a function");
}
cout << $2 << endl;
$$.value=$2.value;
$$.type=$2.type;
$$.numParams = $2.numParams;
$$.returnType = $2.returnType;
......@@ -476,12 +488,14 @@ N_INPUT_EXPR : T_INPUT
;
N_EXPR_LIST : N_EXPR N_EXPR_LIST
{
$$.value = $2.value;
$$.type = $2.type;
$$.numParams = $2.numParams+1;
$$.returnType = NOT_APPLICABLE;
}
| N_EXPR
{
$$.value = $1.value;
$$.type=$1.type;
if($1.type == FUNCTION) {
$$.type = $1.returnType;
......
Value of the expression is: 0
---- Completed parsing ----
Value of the expression is: 60
......@@ -14,7 +14,7 @@ ___Adding sandwich to symbol table
___Exiting scope...
Value of the expression is: 0
---- Completed parsing ----
Value of the expression is: 0
Value of the expression is: 0
---- Completed parsing ----
Value of the expression is: 0
---- Completed parsing ----
Value of the expression is: 20
---- Completed parsing ----
Value of the expression is: 100
---- Completed parsing ----
Value of the expression is: 100
---- Completed parsing ----
Value of the expression is: "false"
---- Completed parsing ----
Value of the expression is: 100
Value of the expression is: 0
---- Completed parsing ----
Value of the expression is: -42
......@@ -4,10 +4,11 @@ ___Entering new scope...
___Adding x to symbol table
___Adding y to symbol table
___Adding z to symbol table
34848944
___Exiting scope...
Value of the expression is: 0
---- Completed parsing ----
Value of the expression is: 0
......@@ -4,10 +4,12 @@ ___Entering new scope...
___Adding x to symbol table
___Adding y to symbol table
___Adding z to symbol table
28856496
28856496
___Exiting scope...
Value of the expression is: 0
---- Completed parsing ----
Value of the expression is: 0
Value of the expression is: 0
---- Completed parsing ----
Value of the expression is: 1
Value of the expression is: 0
---- Completed parsing ----
Value of the expression is: 1
Value of the expression is: 0
---- Completed parsing ----
Value of the expression is: 1
Value of the expression is: 0
---- Completed parsing ----
Value of the expression is: 1
Value of the expression is: 0
---- Completed parsing ----
Value of the expression is: 1
Value of the expression is: 0
---- Completed parsing ----
Value of the expression is: 1
Value of the expression is: 0
---- Completed parsing ----
Value of the expression is: 1
......@@ -33,7 +33,7 @@ ___Exiting scope...
___Exiting scope...
Value of the expression is: 0
---- Completed parsing ----
Value of the expression is: 0
Value of the expression is: 0
---- Completed parsing ----
Value of the expression is: 0
Value of the expression is: 0
---- Completed parsing ----
Value of the expression is: 0
---- Completed parsing ----
Value of the expression is: 0
---- Completed parsing ----
Value of the expression is: 0
---- Completed parsing ----
Value of the expression is: 0
---- Completed parsing ----
"shake"
---- Completed parsing ----
Value of the expression is:
\ No newline at end of file
Value of the expression is: "shake"
Value of the expression is: 0
0
---- Completed parsing ----
Value of the expression is: 0
Value of the expression is: 0
---- Completed parsing ----
Value of the expression is: 1
Value of the expression is: 0
---- Completed parsing ----
Value of the expression is: 1
Value of the expression is: 0
---- Completed parsing ----
Value of the expression is: 0
Value of the expression is: 0
---- Completed parsing ----
Value of the expression is: 1
---- Completed parsing ----
Value of the expression is:
\ No newline at end of file
Value of the expression is: "hello kitty!"
Value of the expression is: 0
---- Completed parsing ----
Value of the expression is: 1
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