|  | @@ -218,10 +218,10 @@ export class IVProgParser {
 | 
												
													
														
															|  |      if(constToken.type === this.lexerClass.RK_CONST) {
 |  |      if(constToken.type === this.lexerClass.RK_CONST) {
 | 
												
													
														
															|  |        this.pos++;
 |  |        this.pos++;
 | 
												
													
														
															|  |        const typeString = this.parseType();
 |  |        const typeString = this.parseType();
 | 
												
													
														
															|  | -      return this.parseDeclararion(typeString, true);
 |  | 
 | 
												
													
														
															|  | 
 |  | +      return this.parseDeclaration(typeString, true);
 | 
												
													
														
															|  |      } else if(this.isVariableType(constToken)) {
 |  |      } else if(this.isVariableType(constToken)) {
 | 
												
													
														
															|  |        const typeString = this.parseType();
 |  |        const typeString = this.parseType();
 | 
												
													
														
															|  | -      return this.parseDeclararion(typeString);
 |  | 
 | 
												
													
														
															|  | 
 |  | +      return this.parseDeclaration(typeString);
 | 
												
													
														
															|  |      } else {
 |  |      } else {
 | 
												
													
														
															|  |        throw SyntaxError.createError(this.lexer.literalNames[this.lexerClass.RK_CONST] + ' or ' + this.getTypesAsString(), constToken);
 |  |        throw SyntaxError.createError(this.lexer.literalNames[this.lexerClass.RK_CONST] + ' or ' + this.getTypesAsString(), constToken);
 | 
												
													
														
															|  |      }
 |  |      }
 | 
												
											
												
													
														
															|  | @@ -232,7 +232,7 @@ export class IVProgParser {
 | 
												
													
														
															|  |    * Parses a declarion of the form: type --- id --- (= --- EAnd)?
 |  |    * Parses a declarion of the form: type --- id --- (= --- EAnd)?
 | 
												
													
														
															|  |    * @returns a list of Declararion(const, type, id, initVal?)
 |  |    * @returns a list of Declararion(const, type, id, initVal?)
 | 
												
													
														
															|  |    **/
 |  |    **/
 | 
												
													
														
															|  | -  parseDeclararion (typeString, isConst = false) {
 |  | 
 | 
												
													
														
															|  | 
 |  | +  parseDeclaration (typeString, isConst = false) {
 | 
												
													
														
															|  |      let initial = null;
 |  |      let initial = null;
 | 
												
													
														
															|  |      let dim1 = null;
 |  |      let dim1 = null;
 | 
												
													
														
															|  |      let dim2 = null;
 |  |      let dim2 = null;
 | 
												
											
												
													
														
															|  | @@ -274,7 +274,7 @@ export class IVProgParser {
 | 
												
													
														
															|  |        this.pos++;
 |  |        this.pos++;
 | 
												
													
														
															|  |        this.consumeNewLines();
 |  |        this.consumeNewLines();
 | 
												
													
														
															|  |        return [declaration]
 |  |        return [declaration]
 | 
												
													
														
															|  | -      .concat(this.parseDeclararion(typeString, isConst));
 |  | 
 | 
												
													
														
															|  | 
 |  | +      .concat(this.parseDeclaration(typeString, isConst));
 | 
												
													
														
															|  |      } else {
 |  |      } else {
 | 
												
													
														
															|  |         return [declaration]
 |  |         return [declaration]
 | 
												
													
														
															|  |      }
 |  |      }
 | 
												
											
												
													
														
															|  | @@ -508,8 +508,8 @@ export class IVProgParser {
 | 
												
													
														
															|  |        if (cmd === null)
 |  |        if (cmd === null)
 | 
												
													
														
															|  |          break;
 |  |          break;
 | 
												
													
														
															|  |        if(cmd !== -1) {
 |  |        if(cmd !== -1) {
 | 
												
													
														
															|  | -        if (cmd instanceof Commands.Declaration) {
 |  | 
 | 
												
													
														
															|  | -          variablesDecl.push(cmd);
 |  | 
 | 
												
													
														
															|  | 
 |  | +        if (cmd instanceof Array) {
 | 
												
													
														
															|  | 
 |  | +          variablesDecl = variablesDecl.concat(cmd);
 | 
												
													
														
															|  |          } else {
 |  |          } else {
 | 
												
													
														
															|  |            commands.push(cmd);
 |  |            commands.push(cmd);
 | 
												
													
														
															|  |          }
 |  |          }
 | 
												
											
												
													
														
															|  | @@ -526,7 +526,6 @@ export class IVProgParser {
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |    parseCommand () {
 |  |    parseCommand () {
 | 
												
													
														
															|  |      const token = this.getToken();
 |  |      const token = this.getToken();
 | 
												
													
														
															|  | -    let cmd = null;
 |  | 
 | 
												
													
														
															|  |      if (this.isVariableType(token)) {
 |  |      if (this.isVariableType(token)) {
 | 
												
													
														
															|  |        if(!this.insideScope(IVProgParser.FUNCTION)) {
 |  |        if(!this.insideScope(IVProgParser.FUNCTION)) {
 | 
												
													
														
															|  |          // TODO better error message
 |  |          // TODO better error message
 | 
												
											
												
													
														
															|  | @@ -535,34 +534,36 @@ export class IVProgParser {
 | 
												
													
														
															|  |        this.pushScope(IVProgParser.BASE);
 |  |        this.pushScope(IVProgParser.BASE);
 | 
												
													
														
															|  |        const varType = this.parseType();
 |  |        const varType = this.parseType();
 | 
												
													
														
															|  |        this.popScope();
 |  |        this.popScope();
 | 
												
													
														
															|  | -      cmd = this.parseDeclararion(varType);
 |  | 
 | 
												
													
														
															|  | 
 |  | +      const cmd = this.parseDeclaration(varType);
 | 
												
													
														
															|  |        this.checkEOS();
 |  |        this.checkEOS();
 | 
												
													
														
															|  |        this.pos++;
 |  |        this.pos++;
 | 
												
													
														
															|  | 
 |  | +      return cmd;
 | 
												
													
														
															|  |      } else if (token.type === this.lexerClass.ID) {
 |  |      } else if (token.type === this.lexerClass.ID) {
 | 
												
													
														
															|  | -      cmd = this.parseIDCommand();
 |  | 
 | 
												
													
														
															|  | 
 |  | +      return this.parseIDCommand();
 | 
												
													
														
															|  |      } else if (token.type === this.lexerClass.RK_RETURN) {
 |  |      } else if (token.type === this.lexerClass.RK_RETURN) {
 | 
												
													
														
															|  | -      cmd = this.parseReturn();
 |  | 
 | 
												
													
														
															|  | 
 |  | +      return this.parseReturn();
 | 
												
													
														
															|  |      } else if (token.type === this.lexerClass.RK_WHILE) {
 |  |      } else if (token.type === this.lexerClass.RK_WHILE) {
 | 
												
													
														
															|  | -      cmd = this.parseWhile();
 |  | 
 | 
												
													
														
															|  | 
 |  | +      return this.parseWhile();
 | 
												
													
														
															|  |      } else if (token.type === this.lexerClass.RK_FOR) {
 |  |      } else if (token.type === this.lexerClass.RK_FOR) {
 | 
												
													
														
															|  | -      cmd = this.parseFor();
 |  | 
 | 
												
													
														
															|  | 
 |  | +      return this.parseFor();
 | 
												
													
														
															|  |      } else if (token.type === this.lexerClass.RK_BREAK ) {
 |  |      } else if (token.type === this.lexerClass.RK_BREAK ) {
 | 
												
													
														
															|  |        if(!this.insideScope(IVProgParser.BREAKABLE)) {
 |  |        if(!this.insideScope(IVProgParser.BREAKABLE)) {
 | 
												
													
														
															|  |          // TODO better error message
 |  |          // TODO better error message
 | 
												
													
														
															|  |          throw new Error("Break cannot be used outside of a loop.");
 |  |          throw new Error("Break cannot be used outside of a loop.");
 | 
												
													
														
															|  |        }
 |  |        }
 | 
												
													
														
															|  | -      cmd = this.parseBreak();
 |  | 
 | 
												
													
														
															|  | 
 |  | +      return this.parseBreak();
 | 
												
													
														
															|  |      } else if (token.type === this.lexerClass.RK_SWITCH) {
 |  |      } else if (token.type === this.lexerClass.RK_SWITCH) {
 | 
												
													
														
															|  | -      cmd = this.parseSwitchCase();
 |  | 
 | 
												
													
														
															|  | 
 |  | +      return this.parseSwitchCase();
 | 
												
													
														
															|  |      } else if (token.type === this.lexerClass.RK_DO) {
 |  |      } else if (token.type === this.lexerClass.RK_DO) {
 | 
												
													
														
															|  | -      cmd = this.parseDoWhile();
 |  | 
 | 
												
													
														
															|  | 
 |  | +      return this.parseDoWhile();
 | 
												
													
														
															|  |      } else if (token.type === this.lexerClass.RK_IF) {
 |  |      } else if (token.type === this.lexerClass.RK_IF) {
 | 
												
													
														
															|  | -      cmd = this.parseIfThenElse();
 |  | 
 | 
												
													
														
															|  | 
 |  | +      return this.parseIfThenElse();
 | 
												
													
														
															|  |      } else if (this.checkEOS(true)){
 |  |      } else if (this.checkEOS(true)){
 | 
												
													
														
															|  |        this.pos++;
 |  |        this.pos++;
 | 
												
													
														
															|  | -      cmd = -1;
 |  | 
 | 
												
													
														
															|  | 
 |  | +      return -1;
 | 
												
													
														
															|  | 
 |  | +    } else {
 | 
												
													
														
															|  | 
 |  | +      return null;
 | 
												
													
														
															|  |      }
 |  |      }
 | 
												
													
														
															|  | -    return cmd;
 |  | 
 | 
												
													
														
															|  |    }
 |  |    }
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |    parseSwitchCase () {
 |  |    parseSwitchCase () {
 |