allow uppercase sc names in preperation for Rlp2Core

This commit is contained in:
crumbtoo
2024-01-22 12:45:42 -07:00
parent e3b18c8915
commit cefdf6ffae
3 changed files with 17 additions and 8 deletions

View File

@@ -26,22 +26,23 @@ import Data.Function ((&))
import GM
----------------------------------------------------------------------------------
-- justLexSrc :: String -> Either RlpcError [CoreToken]
justLexSrc :: String -> Either [MsgEnvelope RlpcError] [CoreToken]
justLexSrc s = lexCoreR (T.pack s)
& fmap (map $ \ (Located _ _ _ t) -> t)
& rlpcToEither
-- justParseSrc :: String -> Either RlpcError Program'
justParseSrc :: String -> Either [MsgEnvelope RlpcError] Program'
justParseSrc s = parse (T.pack s)
& rlpcToEither
where parse = lexCoreR >=> parseCoreProgR
-- justTypeCheckSrc :: String -> Either RlpcError Program'
justTypeCheckSrc :: String -> Either [MsgEnvelope RlpcError] Program'
justTypeCheckSrc s = typechk (T.pack s)
& rlpcToEither
where typechk = lexCoreR >=> parseCoreProgR >=> checkCoreProgR
rlpcToEither = undefined
{-# WARNING rlpcToEither "unimpl" #-}
rlpcToEither :: RLPC a -> Either [MsgEnvelope RlpcError] a
rlpcToEither r = case evalRLPC def r of
(Just a, _) -> Right a
(Nothing, es) -> Left es

View File

@@ -98,6 +98,8 @@ ScDefs : ScDef ';' ScDefs { $1 : $3 }
ScDef :: { ScDef Name }
ScDef : Var ParList '=' Expr { ScDef $1 $2 $4 }
-- hack to allow constructors to be compiled into scs
| Con ParList '=' Expr { ScDef $1 $2 $4 }
Type :: { Type }
Type : Type1 { $1 }