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⟩      ::= < | > | <= | >= | != | ==
⟨join_symb⟩       ::= || | && | OR | AND
⟨concat⟩          ::= &
⟨comma⟩           ::= , | ;


⟨body⟩            ::= ( ⟨assign⟩ | ⟨function⟩ | ⟨if⟩ | ⟨for⟩ | ⟨for_to⟩ | ⟨for_each⟩ | ⟨until⟩ | ⟨while⟩ | ⟨when⟩ | ⟨lambda_call⟩ | ⟨function_call⟩ | ⟨try⟩ | ⟨object_accessor⟩ | ⟨change⟩ | ⟨structure⟩ ) ⟨body⟩

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

⟨var⟩             ::= ⟨var_symb⟩⟨identifier⟩
⟨change_before⟩   ::= ++⟨var_symb⟩ ⟨identifier⟩ | --⟨var_symb⟩ ⟨identifier⟩
⟨change_after⟩    ::= ⟨var_symb⟩ ⟨identifier⟩++ | ⟨var_symb⟩ ⟨identifier⟩--
⟨change⟩          ::= ⟨change_before⟩ | ⟨change_after⟩

⟨undefined⟩       ::= undefined
⟨null⟩            ::= null
⟨bool⟩            ::= true | false
⟨int⟩             ::= ((-?[1-9]+)|[0-9][0-9]*)(E[0-9]+)?
⟨hex⟩             ::= 0x[0-9A-f]+
⟨octal⟩           ::= 0[1-7][0-7]*
⟨double⟩          ::= (-?[0-9]+((\\.)[0-9]+))(E(-?)[0-9]+)?
⟨string⟩          ::= ".*" | '.*'
⟨list⟩            ::= [ ⟨params⟩ ]
⟨map⟩             ::= [ ⟨map_params⟩ ]
⟨internal_doc⟩    ::= << ⟨.*⟩ >>
⟨value⟩           ::= ⟨string⟩ | ⟨int⟩ | ⟨double⟩ | ⟨bool⟩ | ⟨null⟩ | ⟨list⟩ | ⟨map⟩ | ⟨hex⟩ | ⟨octal⟩ | ⟨object⟩ | ⟨lambda1⟩ | ⟨lambda2⟩ | ⟨lambda_function⟩ | ⟨change⟩ | ⟨internal_doc⟩

⟨power⟩           ::= ⟨value⟩ ^ ⟨value⟩

⟨inner⟩           ::= ⟨body⟩ | ε
⟨param_names⟩     ::= ⟨var⟩ , ⟨param_names⟩ | ⟨var⟩ | ε
⟨lambda1⟩         ::= function ( ⟨params_names⟩ ) ⟨inner⟩ | function ( ⟨params_names⟩ ) { ⟨inner⟩ }
⟨lambda2⟩         ::= ( ⟨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⟩ | ( ⟨term⟩ )


⟨expr⟩            ::= ⟨expr_inner⟩ | ⟨expr_inner⟩ ? ⟨value⟩ : ⟨value⟩ | ⟨expr_inner⟩ ?? ⟨value⟩ | ε
⟨expr_inner⟩      ::= ⟨term⟩ ⟨math_symb⟩ ⟨term⟩ | ⟨term⟩ ⟨comparator⟩ ⟨term⟩ | ⟨term⟩ ⟨join_symb⟩ ⟨term⟩ | ⟨term⟩ ⟨concat⟩ ⟨term⟩ | ⟨term⟩ | ε
⟨index⟩           ::= ⟨expr⟩ [ ⟨expr⟩ ]

⟨map_params⟩      ::= ⟨expr⟩ => ⟨expr⟩ , ⟨map_params⟩ | ⟨expr⟩ => ⟨expr⟩ | ε
⟨params⟩          ::= ⟨expr⟩ , | ⟨expr⟩ | ε

⟨assign⟩          ::= ⟨var⟩ | ⟨const⟩ = ⟨expr⟩ | new ⟨identifier⟩ (⟨expr⟩) | new ⟨identifier⟩ ()

⟨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⟩ | ε
⟨as_expr⟩         ::= ⟨expr⟩ as ⟨var⟩ | ⟨expr⟩ as ⟨var⟩ => ⟨var⟩
⟨for_each_as⟩     ::= for each ( ⟨as_expr⟩ ⟨break_when⟩ ) ⟨inner⟩ end for | for each ( ⟨as_expr⟩ ⟨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
Provide feedback on this page
Comments are sent via email to me.