qooxdoo

the new era of web development

 

ASTlets - AST Fragments

Note

Work in Progress

This is an ongoing page to record and document the AST (abstract syntax tree) fragments ("ASTlets"), as they are generated by the tool chain Javascript parser. It shows how certain JS syntax constructs get translated into the corresponding AST representation. This serves mainly internal purposes and should not be relevant for a qooxdoo application developer.

The notation is a simplified tree structure that names token symbols and their nesting through indentation. "|" denotes alternatives.

Syntax Constructs

a[i]

accessor
  identifier ("a")
  key
    variable
      identifier ("i")

a()

call
  operand
    variable
      identifier ("a")
  params

{a : 1}

map
  keyvalue ("a")
    value
      constant (1)

a = b

assignment
  left
    variable
      identifier ("a")
  right
    variable
      identifier("b")

a.b.c(d)

call
  operand
    variable
      identifier ("a")
      identifier ("b")
      identifier ("c")
  params
    variable
      identifier ("d")

a.b().c(d)

accessor
  left
    call
      operand
        variable
          identifier ("a")
          identifier ("b")
  right
    call
      operand
        variable
          identifier ("c")
      params
        variable
          identifier ("d")

[file:] a.b("c",{d:e})

file
  call
    operand
      variable
        identifier ("a")
        identifier ("b")
    params
      constant  ("c")
      map
        keyvalue ("d")
          value
            variable
              identifier ("e")

(function () {return 3;})()

(anonymous function immediately called)

call
  operand
    group
      function
        params
        body
          block
            return
              expression
                constant ("3")

function () {return 3;}()

(anonymous function immediately called - no paren)

call
  operand
    function
      params
      body
        block
          return
            expression
              constant ("3")