Elm Exactly

Figurecore-grammar-expressions

Figure 5, Grammar: Expressions, Matches, Declarations and Bindings, in Section 2.9 Grammar.

atexp\atexp::=scon\sconspecial constant
longvar\longvarvalue variable
longcon\longconvalue constructor
(op)\kw{(}\opv\kw{)}operator value
()\kw{()}unit
( exp1 , exp2 ⟨, exp3⟩ )\kw{(}\ \expm_1\ \kw{,}\ \expm_2\ \opt{\kw{,}\ \expm_3}\ \kw{)}tuple
[ ]\kw{[}\ \kw{]}empty list
{ ⟨exprow⟩ }\kw{\kwlb}\ \opt{\exprow}\ \kw{\kwrb}record
{ var | exprow }\kw{\kwlb}\ \var\ \kw{|}\ \exprow\ \kw{\kwrb}record update
let dec in exp\kw{let}\ \dec\ \kw{in}\ \expmlocal declaration
( exp )\kw{(}\ \expm\ \kw{)}parentheses
exprow\exprow::=lab = exp ⟨, exprow⟩\lab\ \kw{=}\ \expm\ \opt{\kw{,}\ \exprow}expression row
exp\expm::=atexp\atexpatomic
exp atexp\expm\ \atexpapplication (L)
\ atpat -> exp\kw{\textbackslash}\,\atpat\ \kw{->}\ \expmfunction
case exp of match\kw{case}\ \expm\ \kw{of}\ \matchcase analysis
match\match::=mrule ⟨; match⟩\mrule\ \opt{\kw{;}\ \match}match
mrule\mrule::=pat -> exp\pat\ \kw{->}\ \expmmatch rule
dec\dec::=valbind\valbindvalue declaration
valbind\valbind::=var ⟨: ty⟩ = exp ⟨and valbind⟩\var\ \opt{\kw{:}\ \ty}\ \kw{=}\ \expm\ \opt{\kw{and}\ \valbind}variable binding
atpat = exp\atpat\ \kw{=}\ \expmdestructuring binding
Figure 5: Grammar: Expressions, Matches, Declarations and Bindings
Read it in its chapter·Permanent address: /standard/figures/core-grammar-expressions

Referred to from

Tests (5)

Discussions

Discuss this figure·Search the discussions on GitHub

Discussions are on GitHub; one about this figure has [fig:core-grammar-expressions] in its title.

A Standard Definition of Elm? (Draft version 0.4) © Rupert Smith. The text is licensed under CC BY 4.0: share and adapt it freely, with credit and a link to the licence.