Elm Exactly

Figureappendix-full-grammar-expressions

Figure 31, Full Grammar: Expressions, Matches, Declarations and Bindings, in BFull 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
[exp1, ⋯, expn]\kw{[}\expm_1\kw{,}\ \cdots\kw{,}\ \expm_n\kw{]}list (n≥1n \geq 1)†
{ ⟨exprow⟩ }\kw{\kwlb}\ \opt{\exprow}\ \kw{\kwrb}record
{ var | exprow }\kw{\kwlb}\ \var\ \kw{|}\ \exprow\ \kw{\kwrb}record update
.lab\kw{.}\labfield accessor†
atexp.lab\atexp\kw{.}\labfield selection†
-atexp\kw{-}\atexpnegation†
let dec in exp\kw{let}\ \dec\ \kw{in}\ \expmlocal declaration
let valbind1 ⋯ valbindn\kw{let}\ \valbind_1\ \cdots\ \valbind_ndefinitions†
in exp\quad\kw{in}\ \expm(n≥2n \geq 2)
( 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)
exp1 op exp2\expm_1\ \opv\ \expm_2infixed application†
exp1 && exp2\expm_1\ \kw{\&\&}\ \expm_2conjunction†
exp1 || exp2\expm_1\ \kw{||}\ \expm_2disjunction†
\ atpat -> exp\kw{\textbackslash}\,\atpat\ \kw{->}\ \expmfunction
\atpat1⋯atpatn -> exp\kw{\textbackslash}\atpat_1\cdots\atpat_n\ \kw{->}\ \expmfunction (n≥2n \geq 2)†
if exp1 then exp2 else exp3\kw{if}\ \expm_1\ \kw{then}\ \expm_2\ \kw{else}\ \expm_3conditional†
if exp1 then exp1′\kw{if}\ \expm_1\ \kw{then}\ \expm'_1conditional chain†
else if exp2 then exp2′ ⋯\quad\kw{else}\ \kw{if}\ \expm_2\ \kw{then}\ \expm'_2\ \cdots(n≥2n \geq 2)
else if expn then expn′\quad\kw{else}\ \kw{if}\ \expm_n\ \kw{then}\ \expm'_n
else exp\quad\kw{else}\ \expm
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
var ⟨: ty⟩ atpat1⋯atpatn\var\ \opt{\kw{:}\ \ty}\ \atpat_1\cdots\atpat_nfunction binding†
= exp ⟨and valbind⟩\qquad\kw{=}\ \expm\ \opt{\kw{and}\ \valbind}(n≥1n \geq 1)
atpat = exp\atpat\ \kw{=}\ \expmdestructuring binding

† derived form, Appendix A.

Figure 31: Full Grammar: Expressions, Matches, Declarations and Bindings
Read it in its chapter·Permanent address: /standard/figures/appendix-full-grammar-expressions

Referred to from

Tests (0)

No test of the suite checks this figure yet.

Discussions

Discuss this figure·Search the discussions on GitHub

Discussions are on GitHub; one about this figure has [fig:appendix-full-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.