SE250:lab-9:mgha023,rbha033

From Marks Wiki
Jump to navigation Jump to search

Rick (rbha033) and I (mgha023) worked on the lab together...Joint effort:P. Well, this is how far we got. Unfortunately, after much toil, we were dissappointed that it didn't work:( ... Our reflective lab essays are on our respective individual wiki pages...

Code we had:

Tree* Stmt( TokenStream* tokens ) {
 Token n = current(tokens);
 Tree* t1,t2,t3;
 	if( eqToken(n, TOK_IF)){
  	   Tree* t1 = Exp( tokens, 0 );
  	  advance(tokens);
   	   expect(tokens, TOK_THEN);
   	   Tree* t2 = Stmt( tokens );
  	   advance(tokens);
   	  expect(tokens, TOK_ELSE);
     	  Tree* t3 = Stmt( tokens );
	}
    	 // return mkNode3(TOK_IF, mkNode(t1,0), mkNode(t2,0),mkNode(t3,0),0);
 	//return mkNode3(TOK_IF,t1,t2,t3);
 	return mkNode1(TOK_IF,t1);
}

Error we got after compiling it:

H:\ec250\lab9>gcc *.c -o parser && .\parser.exe
parser.c: In function `Stmt':
parser.c:157: error: incompatible type for argument 3 of `mkNode3'
parser.c:157: error: incompatible type for argument 4 of `mkNode3'


H:\ec250\lab9>gcc *.c -o parser && .\parser.exe
Parse("a=1"):
        Incomplete parse
=
        =
Parse("a=1;b=2;k;k;k"):
        Incomplete parse
      7 [main] parser 4340 _cygtls::handle_exceptions: Exception: STATUS_ACCESS_
VIOLATION
  45876 [main] parser 4340 open_stackdumpfile: Dumping stack trace to parser.exe
.stackdump
 155410 [main] parser 4340 _cygtls::handle_exceptions: Exception: STATUS_ACCESS_
VIOLATION
 210257 [main] parser 4340 _cygtls::handle_exceptions: Error while dumping state
 (probably corrupted stack)