Lexical Structure
Comments
Lexer
LINE_COMMENT :
//
(~\n)*BLOCK_COMMENT :
/*
(BLOCK_COMMENT | ~*/
)**/
Comments have no effect on the program.
// This is a line comment
/*
* And this is a multiline (block) comment.
* The stars on the left are purely for aesthetics
*/
Names
Lexer
ID :
(ID_START ID_CONT*)Expect keywordsID_START :
[a
-z
A
-Z
]ID_CONT :
[_
a
-z
A
-Z
0
-9
]
Syntax
ID_List :
ID (,
ID)*,
?
Some valid identifiers are:
snake_case
PascalCase
letters123
Some invalid identifiers are:
chan
, a keyword3D
, starts with a numberkebab-case
, same askebab - case
Keywords
Keyword | Usage |
---|---|
type | Define a type, Existentials, Universals |
dec | Declare a value |
def | Define a value |
chan | Channel expressions, Dualize types |
let | Let expressions and statements |
do | Do expressions |
in | Let expressions, Do expressions |
begin , loop | Iterative constructions, Recursive destruction (expression or statement) |
either | Either types |
recursive | Recursive types |
iterative | Iterative types |
self | Recursive and iterative types |
unfounded | Escape totality checker in recursive expressions and statements |
Punctuation
Symbol | Usage |
---|---|
= | Definitions (values and types), Let expressions and statements |
: | Type annotations, Value declarations, Loop labels |
, | Various enumerations |
! | Unit type, expression, pattern, Break command |
? | Bottom type, Continue command |
. | Labels of either or choice types, used in various places |
<> | Link commands |
< | Type parameters and arguments |
> | Type parameters and arguments |
=> | Choice types and constructions, Match expressions and commands |
( … ) | Pairs, function application |
[ … ] | Functions, pair destruction |
{ … } | Either and choice types, processes |
Whitespace
Whitespace in Par serves merely the purpose of separating tokens. Whitespace characters are:
- The whitespace
' '
- Tabs
'\t'
,'\v'
- Newline
'\n'
- Carriage return
'\r'