Skip to content

Commit

Permalink
Fix the pretty printer to print strings properly. Allow Frank to be
Browse files Browse the repository at this point in the history
run from the command line supplying a program in tests to run.
  • Loading branch information
slindley committed Nov 12, 2016
1 parent c7f1601 commit db3f964
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions Frank.hs
Expand Up @@ -5,6 +5,7 @@ import Compile
import TypeCheck
import RefineSyntax
import DesugarSyntax
import System.Environment
import qualified ExpectedTestOutput as ETO

import Shonky.Semantics
Expand All @@ -20,8 +21,14 @@ compileAndRunProg progName =
Right p' -> do compile p' progName
env <- load progName
case try env "main()" of
Ret v -> print $ ppVal v
comp -> print comp
Ret v -> putStrLn $ ppVal v
comp -> putStrLn (show comp)

run = compileAndRunProg

main :: IO ()
main = compileAndRunProg "paper"
main = do
args <- getArgs
case args of
[file] -> run file
_ -> run "paper"
2 changes: 1 addition & 1 deletion shonky/src/Shonky/Semantics.hs
Expand Up @@ -45,7 +45,7 @@ ppVal :: Val -> String
ppVal (VA s) = "'" ++ s
ppVal (VI n) = show n
ppVal p@(_ :&& _) = "[" ++ ppListVal p
ppVal (VX s) = s
ppVal (VX s) = "\"" ++ s ++ "\""
ppVal v = show v

ppListVal :: Val -> String
Expand Down

0 comments on commit db3f964

Please sign in to comment.