Expression#

An expression in the system refers to a set of operations with a return value, and is a recursive definition. Here exp is used to represent the expression and op is used to represent the operator.

Arithmetic Expression#

The system supports addition (+) subtract (-) multiply (*) divide (/) four kinds of arithmetic operations, arithmetic operation expression returns arithmetic type constant.

Relational Operation Expression#

The system supports relational operations of type > < >= <= == ~=, and relational operation expressions return constant true or false.

Logical Operation Expression#

The system supports logical operations of the and, or, and not types.

exp1 and exp2, if exp1 is true and exp2 is true, then the expression returns true, otherwise returns false.

exp1 or exp2, if exp1 is true or exp2 is true, then the expression returns true, otherwise returns false.

not exp1, if exp1 is true then the expression returns false, otherwise it returns true.

Assignment Expression#

Variable name (id) = exp

The lvalue of an assignment expression is a variable identifier. The expression is an assignment expression only if the variable has already been defined. If the variable is not defined, then it is a variable definition statement.

Function Call Expression#

Function name (argument list)