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

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.

ε symbolises syntactic termination (i.e. the end of a rule)

⟨varsym⟩
  $


⟨math_symb⟩
  +
  -
  /
  *
  %


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


⟨logical_operator⟩
  ||  
  &&
  OR
  AND


⟨concatenate⟩
  &


⟨comma⟩
  ,
  ;


⟨type⟩
  string
  integer
  real
  boolean
  list
  function
  object


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


⟨import⟩
  import ⟨identifier⟩
  import ⟨identifier⟩ as ⟨identifier⟩


⟨body⟩
  ⟨assert⟩
  ⟨import⟩
  ⟨assign⟩
  ⟨function⟩
  ⟨if⟩
  ⟨for⟩
  ⟨for_to⟩
  ⟨for_each⟩
  ⟨until⟩
  ⟨while⟩
  ⟨when⟩
  ⟨lambda_call⟩
  ⟨function_call⟩
  ⟨try⟩
  ⟨object_accessor⟩
  ⟨increment⟩
  ⟨decrement⟩
  ⟨structure⟩
  ⟨breakpoint⟩


⟨breakpoint⟩
  #breakpoint#


⟨label⟩
  label ⟨identifier⟩


⟨goto⟩
  goto ⟨identifier⟩


⟨variable⟩
  ⟨varsym⟩⟨identifier⟩
  ⟨identifier⟩


⟨increment⟩
  ++⟨variable⟩
  ⟨variable⟩++


⟨decrement⟩
  --⟨variable⟩
  ⟨variable⟩--


⟨undefined⟩
  undefined


⟨null⟩
  null


⟨boolean⟩
  true
  false


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


⟨double⟩
  [+-]?(0
  [1-9]+)\.\d+([eE][+-]?\d+)?


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


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


⟨string⟩
  ".*"
  '.*'


⟨list⟩
  [⟨actual_parameters⟩]


⟨map⟩
  [⟨map_pairs⟩]


⟨internal_doc⟩
  << (.*) >>


⟨concatenation⟩
  ⟨string⟩ ⟨concatenate⟩ ⟨string⟩
  ⟨string⟩ ⟨concatenate⟩ ⟨concatenation⟩


⟨value⟩
  ⟨concatenation⟩
  ⟨string⟩
  ⟨integer⟩
  ⟨double⟩
  ⟨boolean⟩
  ⟨null⟩
  ⟨list⟩
  ⟨map⟩
  ⟨hex⟩
  ⟨octal⟩
  ⟨object⟩
  ⟨lambda1⟩
  ⟨lambda2⟩
  ⟨lambda_function⟩
  ⟨increment⟩
  ⟨decrement⟩
  ⟨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⟩
  ⟨increment⟩
  ⟨decrement⟩
  ⟨value⟩
  ⟨lambda_call⟩
  ⟨function_call⟩
  ⟨object_accessor⟩
  ⟨power⟩
  ⟨match_expression⟩
  ⟨count⟩
  ⟨cast⟩
  ( ⟨term⟩ )


⟨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⟩]


⟨assert⟩
  assert(⟨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⟩


⟨inherits⟩
  inherit ⟨identifier⟩
  ε


⟨namespace⟩
  namespace ⟨identifier⟩
  ε


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


⟨structure_id⟩
  structure
  struct
  class


⟨structure⟩
  ⟨structure_id⟩ ⟨identifier⟩ ⟨inherits⟩ ⟨namespace⟩ ⟨structure_inner⟩ end structure
  ⟨structure_id⟩ ⟨identifier⟩ ⟨inherits⟩ { ⟨namespace⟩ ⟨structure_inner⟩ }


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


⟨record⟩
  record ⟨identifier⟩ {⟨record_inner⟩}
  record ⟨identifier⟩ is {⟨record_inner⟩}
  record structure ⟨identifier⟩ {⟨record_inner⟩}
      
Comments

There are no comments on this page.

New comment

Comments are welcome and encouraged, including disagreement and critique. However, this is not a space for abuse. Disagreement is welcome; personal attacks, harassment, or hate will be removed instantly. This site reflects personal opinions, not universal truths. If you can’t distinguish between the two, this probably isn’t the place for you.

Comments powered by BalfComment

Feedback 👍
Comments are sent via email to me.