summaryrefslogtreecommitdiff
path: root/miralib/manual/24
blob: b30a89275874b3e31e8e94881f8e8c83299393a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
_S_y_n_t_a_x_ _o_f_ _M_i_r_a_n_d_a_ _s_c_r_i_p_t_s_ _a_n_d_ _e_x_p_r_e_s_s_i_o_n_s

script:= decl*                          rhs:= simple_rhs(;)
                                              cases
decl:= def
       tdef                             simple_rhs:= exp whdefs?
       spec
       libdir                           cases:= alt(;) = cases
                                                lastcase(;)
def:= fnform = rhs
      pat = rhs                         alt:= exp , _i_f exp

tdef:= tform == type(;)                 lastcase:= lastalt whdefs?
       tform ::= constructs(;)
       _a_b_s_t_y_p_e tform-list _w_i_t_h sig(;)   lastalt:= exp , _i_f exp
                                                  exp , _o_t_h_e_r_w_i_s_e
spec:= var-list :: type(;)
       tform-list :: _t_y_p_e(;)            whdefs:= _w_h_e_r_e def def*

sig:= spec spec*                        exp:= e1
                                              prefix1
constructs:= construct | constructs           infix
             construct
                                        e1:= simple simple*
construct:= constructor argtype*             prefix e1
            type $constructor type           e1 infix e1
            ( construct ) argtype*
                                        simple:= var
type:= argtype                                   constructor
       typename argtype*                         literal
       type -> type                              _r_e_a_d_v_a_l_s
       type $typename type                       _s_h_o_w
                                                 ( infix1 e1 )
argtype:= typename                               ( e1 infix )
          typevar                                ( exp-list? )
          ( type-list? )                         [ exp-list? ]
          [ type-list ]                          [ exp .. exp? ]
                                                 [ exp , exp .. exp? ]
tform:= typename typevar*                        [ exp | qualifs ]
        typevar $typename typevar                [ exp // qualifs ]

fnform:= var formal*                    qualifs:= qualifier ; qualifs
         pat $var pat                             qualifier
         ( fnform ) formal*
                                        qualifier:= exp
pat:= formal                                        generator
      -numeral
      constructor formal*               generator:= pat-list <- exp
      pat : pat                                     pat <- exp , exp ..
      pat + nat
      pat $constructor pat              var:= identifier
      ( pat ) formal*
                                        constructor:= IDENTIFIER
formal:= var
         constructor                    typename:= identifier
         literal1
         ( pat-list? )
         [ pat-list? ]