Macro fungi_lang::fgi_exp [] [src]

macro_rules! fgi_exp {
    { fromast $ast:expr } => { ... };
    { $e:tt : $($c:tt)+ } => { ... };
    { $e:tt : $($c:tt)+ } => { ... };
    { {$($e:tt)+} } => { ... };
    { scope $v:tt $($e:tt)+ } => { ... };
    { ret $($v:tt)+ } => { ... };
    { #$x:ident.$($e:tt)+ } => { ... };
    { fix $x:ident.$($e:tt)+ } => { ... };
    { unroll match $v:tt $($more:tt)+ } => { ... };
    { unroll $v:tt $x:ident.$($e:tt)+ } => { ... };
    { {$($e:tt)+} {!$ref:ident} $($more:tt)* } => { ... };
    { {$($e:tt)+} $v:tt } => { ... };
    { {$($e:tt)+} $v:tt $($more:tt)+ } => { ... };
    { type $t:ident = $a:tt $($e:tt)+ } => { ... };
    { let $x:ident = $e1:tt $($e2:tt)+ } => { ... };
    { let $x:ident : $a:tt = $e1:tt $($e2:tt)+ } => { ... };
    { let rec $x:ident : $a:tt = $e1:tt $($e2:tt)+ } => { ... };
    { thk $v:tt $($e:tt)+ } => { ... };
    { ref $v1:tt $($v2:tt)+ } => { ... };
    { force $($v:tt)+ } => { ... };
    { refthunk $($v:tt)+ } => { ... };
    { get $($v:tt)+ } => { ... };
    { let ($($vars:tt)+) = {$($e1:tt)+} $($e2:tt)+ } => { ... };
    { let ($($vars:tt)+) = $v:tt $($e:tt)+ } => { ... };
    { match $v:tt {$x1:ident=>$e1:tt $x2:ident=>$e2:tt} } => { ... };
    { match $v:tt {$x1:ident=>$e1:tt $x2:ident=>$e2:tt $($more:tt)+} } => { ... };
    { memo{$($e1:tt)+}{$($e2:tt)+} } => { ... };
    { memo($($v:tt)+){$($e:tt)+} } => { ... };
    { match $v:tt {$x1:ident=>$e1:tt $x2:ident=>$e2:tt} } => { ... };
    { if ( $($v:tt)+ ) { $($e1:tt)+ } else { $($e2:tt)+ } } => { ... };
    { if { $($e:tt)+ } { $($e1:tt)+ } else { $($e2:tt)+ } } => { ... };
    { [$($v1:tt)+] $v2:tt } => { ... };
    { [$($v1:tt)+] $v2:tt $($more:tt)+ } => { ... };
    { $v1:tt, $v2:tt } => { ... };
    { $v1:tt, $($more:tt)+ } => { ... };
    { $v1:tt < $v2:tt } => { ... };
    { $v1:tt == $v2:tt } => { ... };
    { $v1:tt <= $v2:tt } => { ... };
    { $v1:tt + $v2:tt } => { ... };
    { unimplemented } => { ... };
    { label ($s:tt) $($e:tt)+ } => { ... };
    { label $n:tt $($e:tt)+ } => { ... };
    { $($any:tt)* } => { ... };
}

Parser for expressions

e::=
    fromast ast                     (inject ast nodes)
    e : C                           (type annotation, no effect)
    e :> E                          (type annotation, with effect)
    {e}                             (parens)
    scope v e                       (memo scope)
    ret v                           (lifted value)
    #x.e                            (lambda)
    fix x.e                         (recursive lambda)
    unroll v x.e                    (unroll recursively-typed value v as x in e)
    unroll match v { ... }          (unroll recursively-typed value and elim sum type)
    {e} {!ref} ...                  (application get-sugar)
    {e} v1 ...                      (extened application)
    type t = (A) e                  (user type shorthand, recursive type)
    let x = {e1} e2                 (let-binding)
    let x : A = {e1} e2             (annotated let-binding)
    let rec x : A = {e1} e2         (annotated let-rec binding)
    thk v e                         (create thunk)
    ref v1 v2                       (create ref)
    force v                         (force thunk)
    refthunk v                      (coerce a value-producing thunk to a ref)
    get v                           (read from ref)
    let (x1,...) = {e1} e2          (let-split sugar)
    let (x1,...) = v e              (extended split)
    memo{e1}{e2}                    (memoize computation, sugar - compute name)
    memo(v){e}                      (memoize computation by name, return ref)
    match v {x1 => e1 ... }         (extended case analysis)
    if { e } { e1 } else { e2 }     (if-then-else; bool elim)
    if ( v ) { e1 } else { e2 }     (if-then-else; bool elim)
    [v1] v2 ...                     (curried name function application)
    v1, v2, ...                     (extended binary name construction)
    v1 < v2                         (less-than)
    unimplemented                   (marker for type checker)
    label (some_text) e             (debug string label)
    nm_lbl (n) e                    (debug name label)