SE250:lab-9:mabd065
Lab 9 Report
I started by looking at all the options. I had no clue on what to do, so i picked option II randomly!
The first problem was the disk space that was running out on a machine. So i had to switch between different
machines until i finally settled down on one!
After downloading the files, I had to use *.c in the compiling statement to be able to compile the whole code.
It compiles fine but doesn't run. After asking, i have been told that i need to implement 2 functions:
- Tree* Stmt( TokenStream* tokens AND - Tree* StmtSeq( TokenStream* tokens )
before i can run the code. So that is what i am going to spend what is left from my time doing.
For the first function, i came up with the following:
code:
Tree* Stmt( TokenStream* tokens ) { //Tree* t = Exp( tokens ); Token text = current(); if (!end_of_tokens) { if (eqToken(text, TOK_IF)) { advance( tokens ); if (eqToken(text, Exp(tokens, P(tokens)) )) { advance( tokens ); if (eqToken(text, TOK_THEN)) { advance( tokens ); if (eqToken, Stmt(tokens) ) { advance( tokens ); // Build the tree } } } } elseif (eqToken(text, TOK_WHILE)) { } elseif (eqToken(text, TOK_OPENBRACE)) { } elseif (isVariable(text)) { } elseif (eqToken(text, TOK_SKIP)) { } elseif (eqToken(text, TOK_PRINT)) { } } }
Not sure if it is write. It is not complete but at least it shows the start.