Jamie Balfour

Welcome to my personal website.

Find out more about me, my personal projects, reviews, courses and much more here.

Official ZPE/YASS documentationYASS formal specification

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. The ε represents a termination case.

⟨variable_symbol⟩
  $


⟨math_symb⟩
  +
  -
  /
  *
  %


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


⟨logical_operator⟩
  ||  
  &&
  OR
  AND


⟨concatenate⟩
  &


⟨comma⟩
  ,
  ;


⟨type⟩
  string
  integer
  real
  boolean
  list
  function
  object


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


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


⟨variable⟩
  ⟨variable_symbol⟩⟨identifier⟩
  ⟨identifier⟩


⟨change_before⟩
  ++⟨variable_symbol⟩⟨identifier⟩
  --⟨variable_symbol⟩⟨identifier⟩


⟨change_after⟩
  ⟨variable_symbol⟩⟨identifier⟩++
  ⟨variable_symbol⟩⟨identifier⟩--


⟨change⟩
  ⟨change_before⟩
  ⟨change_after⟩


⟨undefined⟩
  undefined


⟨null⟩
  null


⟨boolean⟩
  true
  false


⟨integer⟩
  ((-?[1-9]+)
  [0-9][0-9]*)(E[0-9]+)?


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


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


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


⟨string⟩
  ".*"
  '.*'


⟨list⟩
  [⟨actual_parameters⟩]


⟨map⟩
  [⟨map_pairs⟩]


⟨internal_doc⟩
  << (.*) >>


⟨value⟩
  ⟨string⟩
  ⟨integer⟩
  ⟨double⟩
  ⟨boolean⟩
  ⟨null⟩
  ⟨list⟩
  ⟨map⟩
  ⟨hex⟩
  ⟨octal⟩
  ⟨object⟩
  ⟨lambda1⟩
  ⟨lambda2⟩
  ⟨lambda_function⟩
  ⟨change⟩
  ⟨internal_doc⟩


⟨count⟩
  count(⟨value⟩)


⟨cast⟩
  cast(⟨value⟩, ⟨type⟩)


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


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


⟨power⟩
  ⟨value⟩ ^ ⟨value⟩


⟨construct_body⟩
  ⟨body⟩ ⟨construct_body⟩
  ε


⟨formal_parameters⟩
  ⟨variable⟩, ⟨formal_parameters⟩
  ⟨variable⟩
  ⟨type⟩ ⟨variable⟩, ⟨formal_parameters⟩
  ⟨type⟩ ⟨variable⟩
  ⟨variable⟩ ...
  ε


⟨lambda1⟩
  function ( ⟨formal_parameters⟩ ) ⟨construct_body⟩
  function ( ⟨formal_parameters⟩ ) {⟨construct_body⟩}


⟨lambda2⟩
  ( ⟨formal_parameters⟩ ) => ⟨construct_body⟩
  ( ⟨formal_parameters⟩ ) => {⟨construct_body⟩}


⟨function_type⟩
  : ⟨type⟩
  ε


⟨function⟩
  function ⟨identifier⟩ ( ⟨formal_parameters⟩ ) ⟨function_type⟩ ⟨construct_body⟩ end function
  function ⟨identifier⟩ ( ⟨formal_parameters⟩ ) ⟨function_type⟩ {⟨construct_body⟩}


⟨function_call⟩
  ⟨identifier⟩ ( ⟨actual_parameters⟩ )


⟨lambda_call⟩
  ⟨variable⟩ ( ⟨actual_parameters⟩ )


⟨term⟩
  ⟨identifier⟩
  ⟨variable⟩
  ⟨change⟩
  ⟨value⟩
  ⟨lambda_call⟩
  ⟨function_call⟩
  ⟨object_accessor⟩
  ⟨power⟩
  ⟨match_expression⟩
  ( ⟨term⟩ )
  ⟨count⟩
  ⟨cast⟩


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


⟨optional_value⟩
  ⟨expr_inner⟩ ?? ⟨value⟩


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


⟨expression⟩
  ⟨expr_inner⟩
  ⟨ternary_op⟩
  ⟨optional_value⟩
  ε


⟨index⟩
  ⟨expression⟩ [⟨expression⟩]


⟨map_pairs⟩
  ⟨expression⟩ => ⟨expression⟩, ⟨map_pairs⟩
  ⟨expression⟩ => ⟨expression⟩
  ε


⟨actual_parameters⟩
  ⟨expression⟩, ⟨actual_parameters⟩
  ⟨expression⟩
  ε


⟨assign_variable⟩
  let ⟨variable⟩
  ⟨variable⟩
  ⟨const⟩


⟨assign⟩
  ⟨assign_variable⟩ = ⟨expression⟩
  ⟨assign_variable⟩ = new ⟨identifier⟩ (⟨expression⟩)
  ⟨assign_variable⟩ = create new ⟨identifier⟩ record
  ⟨assign_variable⟩ = new ⟨identifier⟩ record
  let ⟨variable⟩ be ⟨expression⟩
  declare ⟨variable⟩ as ⟨type⟩ = ⟨expression⟩


⟨includes⟩
  includes ⟨string⟩


⟨if⟩
  if (⟨expression⟩) ⟨construct_body⟩ ⟨else_if⟩ end if
  if (⟨expression⟩) {⟨construct_body⟩} ⟨else_if⟩


⟨else_if⟩
  elseif (⟨expression⟩) ⟨construct_body⟩ ⟨else_if⟩
  elseif (⟨expression⟩) {⟨construct_body⟩} ⟨elseif⟩
  ⟨else⟩


⟨else⟩
  else (⟨expression⟩) ⟨construct_body⟩
  else (⟨expression⟩) {⟨construct_body⟩}
  ε


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


⟨is⟩
  is ⟨value⟩ do ⟨construct_body⟩ ⟨is⟩
  is ⟨value⟩ ⟨construct_body⟩ ⟨is⟩
  ε


⟨otherwise⟩
  otherwise do ⟨construct_body⟩
  otherwise ⟨construct_body⟩
  ε


⟨for_increment⟩
  ⟨integer⟩
  ⟨expression⟩


⟨for_variable⟩
  ⟨variable⟩
  ⟨assign⟩


⟨for⟩
  for (⟨for_variable⟩ ⟨comma⟩ ⟨expression⟩ ⟨comma⟩ ⟨for_increment⟩) ⟨construct_body⟩ end for
  for ( ⟨for_variable⟩ ⟨comma⟩ ⟨expression⟩ ⟨comma⟩ ⟨for_increment⟩ ) {⟨construct_body⟩}


⟨for_to⟩
  for (⟨integer⟩ to ⟨integer⟩) ⟨construct_body⟩ end for
  for (⟨integer⟩ to ⟨integer⟩) {⟨construct_body⟩}


⟨break_when⟩
  break when ⟨variable⟩ is ⟨expression⟩
  ε


⟨as_expression⟩
  ⟨expression⟩ as ⟨variable⟩
  ⟨expression⟩ as ⟨variable⟩ => ⟨variable⟩


⟨for_each_as⟩
  for each (⟨as_expression⟩ ⟨break_when⟩) ⟨construct_body⟩ end for
  for each ( ⟨as_expression⟩ ⟨break_when⟩ ) {⟨construct_body⟩}


⟨for_each_in⟩
  for each (⟨variable⟩ in ⟨expression⟩ ⟨break_when⟩) ⟨construct_body⟩ end for
  for each ( ⟨variable⟩ in ⟨expression⟩ ⟨break_when⟩ ) {⟨construct_body⟩}


⟨for_each⟩
  ⟨for_each_as⟩
  ⟨for_each_in⟩


⟨until⟩
  loop until (⟨expression⟩) ⟨construct_body⟩ end loop
  loop until (⟨expression⟩) {⟨construct_body⟩}


⟨while⟩
  while (⟨expression⟩) ⟨construct_body⟩ end while
  while (⟨expression⟩) ⟨construct_body⟩


⟨try⟩
  try ⟨construct_body⟩ ⟨catch⟩ end try
  try {⟨construct_body⟩} ⟨catch⟩


⟨catch⟩
  catch (⟨variable⟩) ⟨construct_body⟩
  catch ( ⟨variable⟩ ) {⟨construct_body⟩}
  ε


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


⟨object⟩
  {⟨object_inner⟩}
  { }


⟨object_accessor⟩
  ⟨variable⟩ -> ⟨object_accessor⟩
  ⟨variable⟩ -> ⟨variable⟩
  ⟨variable⟩ -> ⟨function_call⟩
  ⟨variable⟩ -> ⟨lambda_call⟩


⟨structure_inner⟩
  ⟨variable⟩
  ⟨assign⟩
  ⟨function⟩
  ε


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


⟨record_inner⟩
  ⟨type⟩ ⟨identifier⟩ = ⟨expression⟩
  ε


⟨record⟩
  record ⟨identifier⟩ {⟨record_inner⟩}
  record ⟨identifier⟩ is {⟨record_inner⟩}
  record structure ⟨identifier⟩ {⟨record_inner⟩}
      
Comments
Feedback 👍
Comments are sent via email to me.