BNF

Programa ::= Expressao

Expressao ::= Valor | ExpUnaria | ExpBinaria | ExpDeclaracao | Id | Aplicacao | IfThenElse | "self()" | ExpressaoTupla

Valor ::= ValorConcreto | ValorAbstrato

ValorAbstrato ::= ValorFuncao

ValorConcreto ::= ValorInteiro | ValorBooleano | ValorString | ValorTupla | ValorPid

ValorFuncao ::= "fn" ListId "." CompExp

ExpUnaria ::= "-" Expressao | "not" Expressao | "length" Expressao

ExpBinaria ::=
       Expressao "+" Expressao
      | Expressao "-" Expressao
      | Expressao "and" Expressao
      | Expressao "or" Expressao
      | Expressao "==" Expressao
      | Expressao "++" Expressao

ExpDeclaracao ::= "let" DeclaracaoFuncional "in" CompExp

DeclaracaoFuncional ::= DecVariavel | DecFuncao | DeclaracaoFuncional "," DeclaracaoFuncional

DecVariavel ::= "var" Id "=" CompExp

DecFuncao ::= "fun" ListId "=" CompExp

ListId ::= Id | Id ListId

Aplicacao:=Expressao"(" ListExp ")"

ListExp ::= Expressao | Expressao "," ListExp

IfThenElse ::= "if" Expressao "then" CompExp "else" CompExp

ExpProc := ExpProc, ExpProc | Send | Receive | Spawn

Spawn := "spawn("SpawnFunArg, "[" ListExp "]" ")"

SpawnFunArg := Id | ValorFuncao

Receive := "receive" ClauseList "end"

ClauseList := Clause | Clause";" ClauseList

Clause := Pattern "->" CompExp

Pattern :=
      Id
      | ValorConcreto
      | "{"ListPattern"}"

ListPattern := Pattern | Pattern "," ListPattern

Send := Id "!" Message

Message := Expressao | Send

ExpressaoTupla := "{"ListExp"}"

CompExp := ExpProc
      | [ExpProc ","] Expressao ["," ExpProc]

Classes Auxiliares

Exemplos de Programas

Parser