the
language
________ Overview ____________________________________________________
Alice ML is based on the
Standard ML
programming language (SML), as defined in
However, Alice ML features a number of extensions relative to SML (including most current proposals for Successor ML).
You should also be aware of some
________ Syntax summary ______________________________________________
Alice ML defines some additional identifiers as reserved words:
any assert assertd comp constructor exttype
fct finally from import non lazy
pack spawn unpack withfun withval _file_ _line_
The following grammar collects all other syntactic extensions of Alice ML
relative to Standard ML. Derived forms are marked (*).
longid
::=
id
atexp
::=
...
#[ exp1 , ...
,
expn ]
vector (
n≥0)
exp
::=
...
exprow
::=
...
1) The syntax of import items in a first-class component is
restricted to the syntactic subclass of the corresponding descriptions, as
used in signatures.
atpat
::=
...
#[ pat1 , ...
,
patn ]
vector (
n≥0)
pat
::=
...
patrow
::=
...
ty
::=
...
tyrow
::=
...
dec
::=
...
1)
<|>
<op> vid atpat11 ... atpat1n <: ty1>
= exp1
|
<op> vid atpat21 ... atpat2n <: ty2>
= exp2
| ...
|
<op> vid atpatm1 ... atpatmn <: tym>
= expm
<and fvalbind>
econbind
::=
<
op>
vid <
of ty>
: tyvarseq longtycon
<
and econbind>
new constructor
<
op>
vid
= <
op>
longvid
<
and econbind>
synonym
strbind
::=
...
funbind
::=
<
lazy |
spawn>
strid strpat1 ...
strpatn <
: |
:> sigexp>
= strexp
<
and funbind>
functor binding (
n≥1) (*)
2
1) The extended phrase class dec contains all of Standard
ML's dec, strdec and topdec.
2) See the module syntax
summary for a more precise grammar of functor
bindings.
strexp
::=
...
1) See the module syntax
summary for a more precise grammar of structure expressions and functor
application.
sigexp
::=
...
1) See the module syntax
summary for a more precise grammar of functor signatures.
spec
::=
...
econdesc
::=
<
op>
vid <
of ty>
: tyvarseq longtycon
<
and econdesc>
new constructor
1) See the module syntax
summary for a more precise grammar of functor
specifications.
empty
ann <;> ann
imp
::=
val valitem
type typitem
datatype datitem
exttype extitem
constructor econitem
exception exitem
(*)
structure stritem
functor funitem
(*)
signature sigitem
infix <d> vid1
... vidn
(n≥1)
infixr <d> vid1
... vidn
(n≥1)
nonfix vid1
... vidn
(n≥1)
empty
imp <;> imp
valitem
::=
<op> vid
<and valitem>
<op> vid : ty
<and valitem>
typitem
::=
tycon <and typitem>
tyvarseq tycon
<and typitem>
datitem
::=
tycon <and datitem>
tyvarseq tycon = <|> conitem
<and datitem>
conitem
::=
<op> vid <of ty>
<| conitem>
extitem
::=
tycon <and extitem>
tyvarseq tycon
<and extitem>
econitem
::=
<op> vid
<and econitem>
exitem
::=
<op> vid
<and exitem>
(*)
<op> vid of ty
<and exitem>
(*)
stritem
::=
strid <and stritem>
strid : sigexp
<and stritem>
funitem
::=
strid <and funitem>
(*)
strid strpat1 ... strpatn
: sigexp
<and funitem>
(n≥1) (*) 1
sigitem
::=
sigid <and sigitem>
1) See the component syntax
summary for a more precise grammar of functor
items.
last modified 2007年04月10日 15:26