This is a theoretical questions for class programming language and compilers. No need to be done in programming.
Have inquiry about if you can do AST in Java. I have finished the scanner and the parser tree and after that I have to do the AST and the checking type.
here it’s the type rule in the 2nd question
Informal Type Rules
The operands of all OP2, OP3, and OP4 operators must be integers
The OP2 and OP3 operators create an integer result.
The OP4 operators create boolean results.
All variables must be declared with a particular type.
Each variables may only be declared once.
The left-hand of assignment must be a variable, and the right-hand side must be an expression of the variable’s type.
When used as a value, a variable’s type is its declared type.
Only integer variables may be assigned the result of readInt.
writeInt’s expression must evaluate to an integer.
The expression guarding if-statements and while-loops must be boolean.
The literals ”false” and ”true” are boolean constants.
The literal numbers 0 through 2147483647 are integer constants. Numbers outside of that range should be flagged as illegal.
REST ALL INFORMATION IS IN THE FILE ATTACHED
I NEED THIS IN 24 HOURS from now
PRICE: $ 20