## The Language Tenet

August 22, 2020

This document was automatically generated by the BNF-Converter. It was generated together with the lexer, the parser, and the abstract syntax module, which guarantees that the document matches with the implementation of the language (provided no hand-hacking has taken place).

### The lexical structure of Tenet

#### Literals

Integer literals  are nonempty sequences of digits.

String literals  have the form "$x$", where $x$ is any sequence of any characters except " unless preceded by \.

ValId literals are recognized by the regular expression

TypId literals are recognized by the regular expression

#### Reserved words and symbols

The set of reserved words is the set of terminals appearing in the grammar. Those reserved words that consist of non-letter characters are called symbols, and they are treated in a different way from those that are similar to identifiers. The lexer follows rules familiar from languages like Haskell, C, and Java, including longest match and spacing conventions.

The reserved words used in Tenet are the following:

 Func and as break case catch continue def default else eqv false for func gen if imp import in let meta not or pass return switch tenet true try type xor

The symbols used in Tenet are the following:

 ( ) { } . ; , : $-$$>$ # ˜ $+$ $-$ * $|$ $=$$=$ !$=$ $<$ $<$$=$ $>$ $>$$=$ $+$$+$ $|$$|$ $-$$-$ / // % && ... [ ] .. ? !! #( !Unspec :$=$ $=$ $+$$=$ $-$$=$ *$=$ /$=$ //$=$ %$=$ $+$$+$$=$ $|$$|$$=$ &&$=$ $-$$-$$=$

There are no multiple-line comments in the grammar.

### The syntactic structure of Tenet

Non-terminals are enclosed between $⟨$ and $⟩$. The symbols ::= (production), $|$ (union) and $𝜖$ (empty rule) belong to the BNF notation. All other symbols are terminals.

 ::=

 ::= $|$

 ::= tenet $|$ meta ( ) $|$ gen { } $|$ import . $|$ import ( ) $|$ ;

 ::= $𝜖$ $|$

 ::= $|$ $|$ $|$

 ::= $𝜖$ $|$ $|$ ,

 ::= $|$ ( )

 ::= $𝜖$ $|$

 ::= $|$ as $|$ $|$ as

 ::= $|$ ,

 ::= type $|$ def $|$ let $|$ $|$ func ( ) $|$ if $|$ switch $|$ try $|$ for in $|$ return $|$ pass $|$ continue $|$ break $|$ ;

 ::= $|$

 ::= $|$ : $|$

 ::= $𝜖$ $|$ $|$ ,

 ::= $𝜖$ $|$ $-$$>$

 ::= { }

 ::= $𝜖$ $|$ else $|$ else if

 ::= { }

 ::= case : $|$ default :

 ::= $𝜖$ $|$

 ::= catch

 ::= $|$

 ::=

 ::= $|$ ,

 ::= # $|$ ˜ $|$ $|$ $|$ $+$ $|$ $-$ $|$ $|$ ( ) $|$ * $|$ true $|$ false

 ::= : $|$ :

 ::= $𝜖$ $|$ $|$ ,

 ::= $|$ $|$

 ::= xor $|$ eqv $|$ imp $|$

 ::= or $|$

 ::= and $|$

 ::= not $|$

 ::= $=$$=$ $|$ !$=$ $|$ $<$ $|$ $<$$=$ $|$ $>$ $|$ $>$$=$ $|$ in $|$ not in $|$

 ::= $+$ $|$ $-$ $|$ $+$$+$ $|$ $|$$|$ $|$ $-$$-$ $|$

 ::= * $|$ / $|$ // $|$ % $|$ && $|$

 ::= ˜ $|$

 ::= ( ) $|$ ( ... ) $|$ [ ] $|$ [ .. ] $|$ . $|$ ? $|$

 ::= $+$ $|$ $-$ $|$

 ::= $|$ $|$ $|$ false $|$ true $|$ !! ( ) $|$ [ ] $|$ { } $|$ { : } $|$ { } $|$ # $|$ ( ) $|$ #( ) $|$ func ( ) $|$ ( )

 ::= $𝜖$ $|$ $|$ ,

 ::= $|$ : $|$ : $|$ :

 ::= $𝜖$ $|$ $|$ ,

 ::= :

 ::= $𝜖$ $|$ $|$ ,

 ::= :

 ::= $|$ ,

 ::= : $|$ :

 ::= $𝜖$ $|$ $|$ ,

 ::= Func ( ) $-$$>$ $|$

 ::= $|$ $|$

 ::= ˜ $|$

 ::= [ ] $|$ { } $|$ { : } $|$ ( ) $|$

 ::= # $|$ [ ] $|$ $|$ !Unspec $|$ ( )

 ::= :

 ::= $𝜖$ $|$ $|$ ,

 ::= $|$ [ ]

 ::= : $|$ $|$ ( )

 ::= ? $|$ . $|$ [ ] $|$ [ .. ]

 ::= $𝜖$ $|$

 ::= $|$ : $|$ : ( )

 ::= $𝜖$ $|$ $|$ ,

 ::= :$=$ $|$ $=$

 ::= :$=$ $|$ $=$ $|$ $+$$=$ $|$ $-$$=$ $|$ *$=$ $|$ /$=$ $|$ //$=$ $|$ %$=$ $|$ $+$$+$$=$ $|$ $|$$|$$=$ $|$ &&$=$ $|$ $-$$-$$=$

 ::= $|$ ,

 ::=

 ::= $|$ .

 ::=

 ::=

 ::= $|$ ,