Skip to content

wivwiv/page_online

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CoreErlang

CoreErlang is a haskell library which consists on a parser and pretty-printer for the intermediate language used by Erlang.

The parser uses the Parsec library and the pretty-printer was modelled after the corresponding module of the haskell-src package. It also exposes a Syntax module which allows easy manipulation of terms.

It is able to parse and pretty print all of Core Erlang. Remaining work includes customizing the pretty printer and refining the syntax interface.

Syntax

module ::= module Atom [fnamei1 , ... , fnameik] attributes [attr1, ..., attrm] fundef1 ... fundefn end

attr ::= Atom = const

fundef ::= fname = fun

fname ::= Atom / Integer

const ::= lit | clist | ctuple | cmap

clist ::= [const1 | const2]

ctuple ::= {const1 , ..., constn}

cmap ::= ~{const1 => const2 , ..., constm => constn}~

lit ::= Atom | Integer | Float | Char | String | [ ]

fun ::= fun (var1, ..., varn) -> exprs

var ::= VariableName

exprs ::= expr | <expr1 , ..., exprn>

expr ::= var | fname | lit | fun

| [*exprs<sub>1</sub>* | *exprs<sub>2</sub>*]

| {*exprs<sub>1</sub>*, ...,  *exprs<sub>n</sub>*}

| \~{*exprs<sub>1</sub>* => *exprs<sub>2</sub>* , ..., *exprs<sub>m</sub>* => *exprs<sub>n</sub>*}\~

| **let** *vars* = *exprs<sub>1</sub>* **in** *exprs<sub>2</sub>*

| **case** *exprs* **of** *clause<sub>1</sub>* · · · *clause<sub>n</sub>* **end**

| **letrec** *fname<sub>1</sub>* = *fun<sub>1</sub>* · · · *fname<sub>n</sub>* = *fun<sub>n</sub>* **in** *exprs*

| **apply** *exprs<sub>0</sub>* (*exprs<sub>1</sub>*, . . ., *exprs<sub>n</sub>*)

| **call** *exprs′<sub>1</sub>*:*exprs′<sub>2</sub>*(*exprs<sub>1</sub>*, . . ., *exprs<sub>n</sub>*)

| **primop** *Atom*(*exprs<sub>1</sub>*, . . ., *exprs<sub>n</sub>*)

| **receive** *clause<sub>1</sub>* · · · *clause<sub>n</sub>* **after** *exprs<sub>1</sub>* -> *exprs<sub>2</sub>*

| **try** *exprs<sub>1</sub>* **of** <*var<sub>1</sub>*, . . .*var<sub>n</sub>*> -> *exprs<sub>2</sub>*

**catch** <*var<sub>n+1</sub>*, . . .*var<sub>n+m</sub>*> -> *exprs<sub>3</sub>*

| **do** *exprs<sub>1</sub>* *exprs<sub>2</sub>*

| **catch** *exprs*

vars ::= var | <var1, ..., varn>

clause ::= pats when exprs1 -> exprs2

pats ::= pat | <pat1, ..., patn>

pat ::= var | lit | var = pat | plist | ptuple | pmap

plist ::= [pat1 | pat2]

ptuple ::= {pat1, ..., patn}

pmap ::= ~{pkey1 := pat1, ..., pkeyn := patn}~

pkey ::= var | lit

License

BSD3

Authors

About

基于Java-Mysql的在线系统

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages