Skip to content

Commit

Permalink
Call typecheck
Browse files Browse the repository at this point in the history
  • Loading branch information
Saverio976 committed Jan 14, 2024
1 parent 6f9fa7e commit a93fdb0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions lvtc/app/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import WatLikeToWat (watsLikeToWat)
import Wasm (Wasm)
import WatToWasm (watToWasm)
import WriteWasm (writeWasm)
import TypeCheck (typeCheck)
import Args

import System.Directory (listDirectory)
Expand Down Expand Up @@ -90,9 +91,9 @@ getAllFunc v (x : expressions) = p v >> getAllFunc v expressions
checkAst :: Bool -> IO [FuncDeclaration] -> IO [FuncDeclaration]
checkAst _ funcsIo =
funcsIo
>>= (\funcs -> case Just funcs of
Just f -> return f
Nothing -> fail "Invalid Code")
>>= (\funcs -> case typeCheck funcs of
True -> return funcs
False -> fail "Invalid Code")

transformToWatLike :: Bool -> IO [FuncDeclaration] -> IO [FuncDeclare]
transformToWatLike v funcsIo =
Expand Down
2 changes: 1 addition & 1 deletion lvtc/test/lvt/Test.lvt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export fn start() -> Char
export fn start() -> Int
{
@Int a = 0 + 1;
@Int b = a - 1;
Expand Down

0 comments on commit a93fdb0

Please sign in to comment.