interpreter first version
This commit is contained in:
parent
05d670817e
commit
b5001499d7
4 changed files with 63 additions and 6 deletions
10
app/Main.hs
10
app/Main.hs
|
|
@ -1,10 +1,12 @@
|
|||
module Main where
|
||||
|
||||
import Lox.Scanner
|
||||
import Lox.Parser
|
||||
import Lox.Interpreter
|
||||
|
||||
run :: String -> IO ()
|
||||
run source = mapM_ print tokens
|
||||
where tokens = scanTokensFromSource source
|
||||
run source = print result
|
||||
where result = eval expr
|
||||
expr = parse tokens
|
||||
tokens = scanTokensFromSource source
|
||||
|
||||
main :: IO ()
|
||||
main = getLine >>= run
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue