_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? ]