( Expression ) in PrimaryExpression

If I have such a C0 code:

x = 5 + (6 / 3);

(6 / 3) is then a PrimaryExpression and has 6 / 3 as a token’s name. Is it right?

The brackets are only part of the concrete syntax and are already handled by the parser. Thus in your example, it would call (conceptualized, with a few arguments missing)

x0 = createPrimaryExpression // for 5
x1 = createPrimaryExpression // for 3
x2 = createPrimaryExpression // for 6
x3 = createBinaryExpression(x1,x2) // for /
x4 = createBinaryExpression(x0,x3) // for +

that would not make any sense.

1 Like