v3 Parsing: calls, indexing, literals

Expression architecture

  • Expression starts at equality and descends through comparison -> term -> factor -> unary -> postfix.
  • This keeps precedence simple and predictable.

Postfix chaining

postfix -> primary (call | index)*

  • left-to-right chaining
  • each () becomes ExprCall
  • each [] becomes ExprIndex

Function declarations as statements

  • fn can appear in block contexts.
  • nested function parsing is just recursive parse of nested statements.

Literal parsing

  • array and map are primaries.
  • empty literals are legal: [], {}.
  • map requires colon between key and value.

L-value checks

  • assignments use parse-time target validation:
    • allowed: identifier or index expression
    • rejected: call/member/complex ops on LHS

Practice focus

  • nested call + index chains
  • map delimiter errors
  • block/literal boundary understanding
  • return with and without expression
1 / 1
Use arrow keys or click edges to navigate. Press H to toggle help, F for fullscreen.