L-value and assignable L-Value

I would like to know what’s the difference between the L-value and assignable L-Value, are they actually the same thing?

is the L-Value a String (does this mean it is a instance of variableExpression under the primaryExpression??? ) or an indirection(e) and the operand is a pointer to a complete type (does it mean that the type of the expression should is simply a completet pointer type <==> char/int*)?

An expression in
TinyC is an L-value, if and only if the expression is an identifier or if the expression is an indirection (*e) and the
operand is a pointer to a complete type.

Assignable in Table 2 means that not only does the left hand side have to be an L-value, but also the rules in 4.1.3 must be satisfied.

an instance of a VariableExpression

Guessing from that class name, probably? When a variable is used as the left hand side in an assignment expression, this is indeed an L-value.

the operand is a pointer to a complete type

Incomplete types are void and function types. All others, so int, char and pointers, are complete.
This means that int*, char* and pointers to pointers are valid types for the operand of an indirection, so that the indirection expression is an L-expression.

hi Jonathan thanks for the explanation about the operand pointer part.

yes, VarialeExpression is my class name for the primaryExpression Identifier (variable), so i just want to make sure if it is okay, when i just call the istanceof method to check if my left expression is a varable…is it too simple…or did i think too much
thanks in advance :slight_smile:

just call instanceof

Would work, but instanceof is generally considered bad style.
You could also add a method isLExpr to your Expression class, which returns false by default and is overriden in your Indirection and Variable expressions.

okay, i see, thanks again for your help:)