package wcs-lib

  1. Overview
  2. Docs

Spel abstract syntax tree.

Spel AST
type spel_type =
  1. | T_string
  2. | T_int
  3. | T_real
  4. | T_boolean
  5. | T_object

atomic types

type literal =
  1. | L_string of string
  2. | L_int of int
  3. | L_real of float
  4. | L_boolean of bool
  5. | L_null

literals

type op =
  1. | Op_eq
  2. | Op_ne
  3. | Op_lt
  4. | Op_le
  5. | Op_gt
  6. | Op_ge
  7. | Op_not
  8. | Op_and
  9. | Op_or
  10. | Op_plus
  11. | Op_minus
  12. | Op_uminus
  13. | Op_mult
  14. | Op_div
  15. | Op_mod
  16. | Op_concat
  17. | Op_toString

operators

type expression = {
  1. expr_desc : expression_desc;
  2. expr_loc : location;
  3. mutable expr_text : string option;
}

expressions

and expression_desc =
  1. | E_lit of literal
  2. | E_prop of expression * string
    (*

    e.x

    *)
  3. | E_prop_catch of expression * string
    (*

    e?.x

    *)
  4. | E_get of expression * expression
    (*

    e1[e2]

    *)
  5. | E_list of expression list
    (*

    { e1, e2 .. }

    *)
  6. | E_new_array of spel_type * int option list * expression list option
    (*

    new T[]{ e1, e2 ... }

    *)
  7. | E_new of string * expression list
    (*

    new T(e1,e2...)

    *)
  8. | E_call of expression option * string * expression list
    (*

    e.m(e1,e2...)

    *)
  9. | E_call_catch of expression option * string * expression list
    (*

    e?.m(e1,e2...)

    *)
  10. | E_op of op * expression list
  11. | E_conditional of expression * expression * expression
    (*

    e1?e2:e3

    *)
  12. | E_ident of string
    (*

    v

    *)
  13. | E_anything_else
    (*

    anything_else

    *)
  14. | E_context
    (*

    context

    *)
  15. | E_conversation_start
    (*

    conversation_start

    *)
  16. | E_entities
    (*

    entities

    *)
  17. | E_input
    (*

    input

    *)
  18. | E_intents
    (*

    entities

    *)
  19. | E_output
    (*

    output

    *)
  20. | E_variable of string * string option
    (*

    $v or $v:(w)

    *)
  21. | E_intent of string
    (*

    #intent

    *)
  22. | E_entity of string * string option
    (*

    @a or @a:(b)

    *)
  23. | E_error of string
type spel = expression