Log In

I Want A Java Files

You will submit your existing files (Parser.java, Node.java, IntegerNode.java, FloatNode.java, MathOpNode.java, Basic.java, Token.java, Lexer.java, VariableNode.java, PrintNode.java, AssignmentNode.java, StatementNode.java, StatementsNode.java, StringNode.java, DataNode.java, ReadNode.java, InputNode.java, LabeledStatementNode.java, GosubNode.java, ReturnNode.java, ForNode.java, NextNode.java) and your new files: IfNode.java, BooleanOperationNode.java, FunctionNode.java

Add statement for IF. Note that you will need to create a Boolean expression parser. We are going to keep this super simple – a Boolean expression must follow the pattern: Expression operator Expression

Operator is >, >=, <, <=, <>, =

Finally, we need to deal with functions. Add the function names to the lexer. Functions are an additional option for EXPRESSION. Remember that we had EXPRESSION as

EXPRESSION = TERM { (plus or minus) TERM}

It now should be:

EXPRESSION = TERM { (plus or minus) TERM} or functionInvocation

Make a new parser method for functionInvocation that looks for the appropriate keywords and returns a FunctionNode or NULL. A function follows this pattern:

FUNCTIONNAME LPAREN parameterList RPAREN

A parameterList is empty OR a list (1 or more) of EXPRESSION or STRING

× How can I help?