Skip to content

Commit

Permalink
add function for getting functions out of program
Browse files Browse the repository at this point in the history
  • Loading branch information
ALescoulie committed Mar 6, 2024
1 parent 000c9d8 commit eb9d0f1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/Mentat/SyntaxParser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,22 @@ parseVariables (Program smtList) = do
let repeats = repeatItems vars
if null repeats then Right (HM.fromList decl) else Left $ DuplicateVars repeats


parseFxns :: Program -> Either Error (HM.Map String Function)
parseFxns (Program []) = Right HM.empty
parseFxns (Program smtList) = do
let fxnNames = getFxnNames smtList
let fxns =
mapMaybe
( \case
Fxn f -> Just f
_ -> Nothing
)
smtList
let fxnList = zip fxnNames fxns
Right (HM.fromList fxnList)


buildExpr :: String -> Either Error Expr
buildExpr [] = Left EmptyExpr
buildExpr str = do
Expand Down

0 comments on commit eb9d0f1

Please sign in to comment.