This commit is contained in:
crumbtoo
2023-12-06 17:15:03 -07:00
parent f6d87cfb6b
commit dade0a13a2
4 changed files with 24 additions and 11 deletions

View File

@@ -117,6 +117,18 @@ simple1 = [coreProg|
main = s k k 3;
|]
caseBool1 = [coreProg|
_if c x y = case c of
{ 1 -> x
; 0 -> y
};
false = Pack{0 0};
true = Pack{1 0};
main = _if false ((+#) 2 3) ((*#) 4 5);
|]
corePrelude :: Module
corePrelude = Module (Just ("Prelude", [])) $
-- non-primitive defs

View File

@@ -68,7 +68,6 @@ rlp :-
"{" { constTok TokenLBrace }
"}" { constTok TokenRBrace }
";" { constTok TokenSemicolon }
"," { constTok TokenComma }
"{-#" { constTok TokenLPragma `andBegin` pragma }
"let" { constTok TokenLet }
@@ -121,7 +120,6 @@ data CoreToken = TokenLet
| TokenIn
| TokenModule
| TokenWhere
| TokenComma
| TokenPack -- temp
| TokenCase
| TokenOf

View File

@@ -36,7 +36,6 @@ import Data.Default.Class (def)
where { Located _ _ _ TokenWhere }
case { Located _ _ _ TokenCase }
of { Located _ _ _ TokenOf }
',' { Located _ _ _ TokenComma }
pack { Located _ _ _ TokenPack } -- temp
in { Located _ _ _ TokenIn }
litint { Located _ _ _ (TokenLitInt $$) }
@@ -136,7 +135,7 @@ Words : word Words { $1 : $2 }
| word { [$1] }
PackCon :: { Expr }
PackCon : pack '{' litint ',' litint '}' { Con $3 $5 }
PackCon : pack '{' litint litint '}' { Con $3 $4 }
Bindings :: { [Binding] }
Bindings : Binding ';' Bindings { $1 : $3 }