case unrolling

This commit is contained in:
crumbtoo
2024-02-06 13:39:01 -07:00
parent 15884336f1
commit 2895e3cb48
6 changed files with 36 additions and 12 deletions

View File

@@ -154,11 +154,19 @@ Params : {- epsilon -} { [] }
| Params Pat1 { $1 `snoc` $2 }
Pat :: { Pat' RlpcPs }
: Pat1 { $1 }
: Con Pat1s { $1 =>> \cn ->
ConP (extract $1) $2 }
| Pat1 { $1 }
Pat1s :: { [Pat' RlpcPs] }
: Pat1s Pat1 { $1 `snoc` $2 }
| Pat1 { [$1] }
Pat1 :: { Pat' RlpcPs }
: Var { fmap VarP $1 }
: Con { fmap (`ConP` []) $1 }
| Var { fmap VarP $1 }
| Lit { LitP <<= $1 }
| '(' Pat ')' { $1 .> $2 <. $3 }
Expr :: { RlpExpr' RlpcPs }
: Expr1 InfixOp Expr { $2 =>> \o ->

View File

@@ -11,7 +11,7 @@ module Rlp.Syntax
, progDecls
, Decl(..), Decl', RlpExpr(..), RlpExpr'
, Pat(..), Pat'
, Alt(..)
, Alt(..), Where
, Assoc(..)
, Lit(..), Lit'
, RlpType(..), RlpType'