To use this website fully, you first need to accept the use of cookies. By agreeing to the use of cookies you consent to the use of functional cookies. For more information read this page.

Official ZPE/YASS documentationYASS formal specification

The following is the official YASS formal specification (actually it's Backus–Naur Form) for the latest version of YASS.

YASS
⟨var_symb⟩
  $

⟨math_symb⟩
  +
  -
  /
  *
  %

⟨comparator⟩
  <
  >
  <=
  >=
  !=
  ==

⟨logical_operator⟩
  ||
  &&
  OR
  AND

⟨concat⟩
  &

⟨comma⟩
  ,
  ;

⟨body⟩
  ⟨assign⟩⟨body⟩
  ⟨function⟩⟨body⟩
  ⟨if⟩ ⟨body⟩
  ⟨for⟩ ⟨body⟩
  ⟨for_to⟩ ⟨body⟩
  ⟨for_each⟩ ⟨body⟩
  ⟨until⟩⟨body⟩
  ⟨while⟩ ⟨body⟩
  ⟨when⟩ ⟨body⟩
  ⟨lambda_call⟩ ⟨body⟩
  ⟨function_call⟩ ⟨body⟩
  ⟨try⟩ ⟨body⟩
  ⟨object_accessor⟩ ⟨body⟩
  ⟨change⟩ ⟨body⟩
  ⟨structure⟩ ⟨body⟩
  ε

⟨identifier⟩
  regex : _?[A-z][A-z0-9_]*

⟨var⟩
  ⟨var_symb⟩⟨identifier⟩
  ⟨identifier⟩

⟨change⟩
  ++⟨var⟩
  --⟨var⟩
  ⟨var⟩++
  ⟨var⟩--
  ⟨var⟩+=⟨value⟩
  ⟨var⟩-=⟨value⟩
  ⟨var⟩/=⟨value⟩
  ⟨var⟩*=⟨value⟩

⟨power⟩
  ⟨value⟩ ^ ⟨value⟩

⟨undefined⟩
  undefined

⟨null⟩
  null

⟨bool⟩
  true
  false

⟨int⟩
  regex : ((-?[1-9]+)|[0-9][0-9]*)(E[0-9]+)?

⟨hex⟩
  regex : 0x[0-9A-f]+

⟨octal⟩
  regex : 0[1-7][0-7]*

⟨double⟩
  regex : (-?[0-9]+((\\.)[0-9]+))(E(-?)[0-9]+)?

⟨string⟩
  regex : ".*" | '.*'

⟨list⟩
  [ ⟨params⟩ ]

⟨map⟩
  [ ⟨map_params⟩ ]

⟨internal_doc⟩
  regex : << (.*) >>

⟨value⟩
  ⟨string⟩
  ⟨int⟩
  ⟨double⟩
  ⟨bool⟩
  ⟨null⟩
  ⟨list⟩
  ⟨map⟩
  ⟨hex⟩
  ⟨octal⟩
  ⟨object⟩
  ⟨lambda_function⟩
  ⟨change⟩
  ⟨internal_doc⟩
  ⟨power⟩

⟨match_inner⟩
  ⟨value⟩ => ⟨value⟩ ⟨match_inner⟩
  ⟨value⟩ => ⟨value⟩, ⟨match_inner⟩
  ⟨value⟩ => ⟨value⟩
  ε

⟨match_expr⟩
  match( ⟨value⟩ : ⟨match_inner⟩)

⟨inner⟩
  ⟨body⟩
  ε

⟨param_names⟩
  ⟨var⟩ , ⟨param_names⟩
  ⟨var⟩ | ⟨var⟩ ..
  ε

⟨lambda_function⟩
  function ( ⟨params_names⟩ ) ⟨inner⟩
  function ( ⟨params_names⟩ ) { ⟨inner⟩ }
  ( ⟨params_names⟩ ) => ⟨inner⟩
  ( ⟨params_names⟩ ) => { ⟨inner⟩ }

⟨function⟩
  function ⟨identifier⟩ ( ⟨param_names⟩ ) ⟨inner⟩ end function
  function ⟨identifier⟩ ( ⟨param_names⟩ ) { ⟨inner⟩ }

⟨function_call⟩
  ⟨identifier⟩ ( ⟨params⟩ )

⟨lambda_call⟩
  ⟨var⟩ ( ⟨params⟩ )

⟨term⟩
  ⟨identifier⟩
  ⟨var⟩
  ⟨change⟩
  ⟨value⟩
  ⟨lambda_call⟩
  ⟨function_call⟩
  ⟨object_accessor⟩
  ⟨power⟩
  ⟨match_expr⟩
  ( ⟨term⟩ )

⟨ternary_op⟩
  ⟨expr_inner⟩ ? ⟨value⟩ : ⟨value⟩

⟨optional_value⟩
  ⟨expr_inner⟩ ?? ⟨value⟩

⟨expr⟩
  ⟨expr_inner⟩
  ⟨ternary_op⟩
  ⟨optional_value⟩
  ε

⟨expr_inner⟩
  ⟨term⟩ ⟨math_symb⟩ ⟨term⟩
  ⟨term⟩ ⟨comparator⟩ ⟨term⟩
  ⟨term⟩ ⟨logical_operator⟩ ⟨term⟩
  ⟨term⟩ ⟨concat⟩ ⟨term⟩
  ⟨term⟩
  ε

⟨index⟩
  ⟨expr⟩ [ ⟨expr⟩ ]

⟨map_params⟩
  ⟨expr⟩ => ⟨expr⟩ , ⟨map_params⟩
  ⟨expr⟩ => ⟨expr⟩
  ε

⟨params⟩
  ⟨expr⟩,
  ⟨expr⟩
  ε

⟨type⟩
  boolean
  number
  string
  object
  function
  list

⟨assign_var⟩
  let ⟨var⟩
  ⟨var⟩
  ⟨const⟩
  ⟨type⟩ ⟨var⟩
  ⟨var⟩ as ⟨type⟩

⟨assign⟩
  ⟨assign_var⟩ = ⟨expr⟩
  ⟨assign_var⟩ = new ⟨identifier⟩ (⟨expr⟩)
  ⟨assign_var⟩ = new ⟨identifier⟩ ()
  let ⟨var⟩ be ⟨expr⟩

⟨includes⟩
  includes ⟨string⟩

⟨if⟩
  if ( ⟨expr⟩ ) ⟨inner⟩ ⟨else_if⟩ end if
  if ( ⟨expr⟩ ) { ⟨inner⟩ } ⟨else_if⟩

⟨else_if⟩
  else if ( ⟨expr⟩ ) ⟨inner⟩ ⟨else if⟩
  else if ( ⟨expr⟩ ) { ⟨inner⟩ } ⟨else if⟩
  ε

⟨when⟩
  when ( ⟨var⟩ ) ⟨is⟩ ⟨otherwise⟩ end when
  when ( ⟨var⟩ ) { ⟨is⟩ ⟨otherwise⟩ }

⟨is⟩
  is ⟨value⟩ do ⟨inner⟩ ⟨is⟩
  is ⟨value⟩ ⟨inner⟩ ⟨is⟩
  ε

⟨otherwise⟩
  otherwise do ⟨inner⟩
  otherwise ⟨inner⟩
  ε

⟨for_increment⟩
  ⟨int⟩
  ⟨expr⟩

⟨for_variable⟩
  ⟨var⟩
  ⟨assign⟩

⟨for⟩
  for ( ⟨for_variable⟩ ⟨comma⟩ ⟨expr⟩ ⟨comma⟩ ⟨for_increment⟩ ) ⟨inner⟩ end for
  for ( ⟨for_variable⟩ ⟨comma⟩ ⟨expr⟩ ⟨comma⟩ ⟨for_increment⟩ ) { ⟨inner⟩ }

⟨for_to⟩
  for ( ⟨int⟩ to ⟨int⟩ ) ⟨inner⟩ end for
  for ( ⟨int⟩ to ⟨int⟩ ) { ⟨inner⟩ }

⟨break_when⟩
  break when ⟨var⟩ is ⟨expr⟩
  ε


⟨for_each_as⟩
  for each ( ⟨expr⟩ as ⟨var⟩ ⟨break_when⟩ ) ⟨inner⟩ end for
  for each ( ⟨expr⟩ as ⟨var⟩ => ⟨var⟩ ⟨break_when⟩ ) ⟨inner⟩ end for
  for each ( ⟨expr⟩ as ⟨var⟩ ⟨break_when⟩ ) { ⟨inner⟩ }
  for each ( ⟨expr⟩ as ⟨var⟩ => ⟨var⟩ ⟨break_when⟩ ) { ⟨inner⟩ }

⟨for_each_in⟩
  for each ( ⟨var⟩ in ⟨expr⟩ ⟨break_when⟩ ) ⟨inner⟩ end for
  for each ( ⟨var⟩ in ⟨expr⟩ ⟨break_when⟩ ) { ⟨inner⟩ }

⟨for_each⟩
  ⟨for_each_as⟩
  ⟨for_each_in⟩

⟨until⟩
  loop until ( ⟨expr⟩ ) ⟨inner⟩ end loop
  loop until ( ⟨expr⟩ ) { ⟨inner⟩ }

⟨while⟩
  while ( ⟨expr⟩ ) ⟨inner⟩ end while
  while ( ⟨expr⟩ ) ⟨inner⟩

⟨try⟩
  try ⟨inner⟩ ⟨catch⟩ end try
  try { ⟨inner⟩ } ⟨catch⟩

⟨catch⟩
  catch ( ⟨var⟩ ) ⟨inner⟩
  catch ( ⟨var⟩ ) { ⟨inner⟩ }
  ε

⟨object_inner⟩
  ⟨identifier⟩ : ⟨value⟩ [, ⟨object_inner⟩]
  ⟨string⟩ : ⟨value⟩ [, ⟨object_inner⟩]
  ε

⟨object⟩
  { ⟨object_inner⟩ }
  { }

⟨object_accessor⟩
  ⟨var⟩ -> ⟨object_accessor⟩
  ⟨var⟩ -> ⟨var⟩
  ⟨var⟩ -> ⟨function_call⟩
  ⟨var⟩ -> ⟨lambda_call⟩

⟨structure_inner⟩
  ⟨var⟩
  ⟨assign⟩
  ⟨function⟩
  ε

⟨structure⟩
  structure ⟨identifier⟩ ⟨structure_inner⟩ end structure
  structure ⟨identifier⟩ { ⟨structure_inner⟩ }
      
Comments

There are no comments on this page.

New comment
Reply
Feedback 👍
Comments are sent via email to me.