Simple Ide For MicroJ

A string assigned to microJ is first converted to tokens by controlling the character character in the scanner class. The types of tokens are determined by the four conditions in the nextToken() method of the Scanner class.

In the first condition, it is checked whether the incoming character is a space, a tab space or a line blanking. In the second condition, it is checked whether the character is a letter. In the third condition it is checked whether the character is a number. If the character does not provide these three conditions, the characters defined in the Token class are looked at. If the selected character is not in the Token class, the result is EOF. The Scanner resolves characters such as numbers, identifiers, plus and minuses in the given string and converts them to Token. String, after turning to tokens, there are two sections. These are Checker and Parser.

Checker's task is to check whether a String is written correctly for microJ. That is, it checks whether the String matches the grammar of microJ. In Checker, the values of Tokens are not seen, new objects are not created, calculations are not done. The task of the Parser is to check whether the string is written according to the microJ grammar and to return the result by making calculations according to the given values.

In the parser class, the first control in the statement() method is done on "print". The value of the Token is compared and compared. If the value equals "print", a new PrintStat object is created. PrintStat takes an Expression as a parameter. So we can print a constant value, or we can calculate and print a mathematical function. If the Token's value is not "print" then the microJ accepts the incoming token as a variable, and a new Assignment object is created. This assignment object takes a String variable name as a parameter and an Expression function or a constant value. Let's not forget that just before the Assignment object has been created, the '=' character between the variable and the value is checked by the check() method. If it is not equal, the exception is thrown and the process is interrupted. In the expr() function, the given mathematical operations are computed and the results are returned.

This website is created by Ibrahim Enes Aydogdu.

This IDE is created by Ibrahim Enes Aydogdu.

This IDE is only works for MicroJ0.

Download to Project