@@ -71,7 +71,7 @@ parserCommandsForHelp =
71 , noArgCmd ["proofs"] Proofs "Show available proofs"
71 , noArgCmd ["proofs"] Proofs "Show available proofs"
72 , exprArgCmd ["x"] ExecVal "Execute IO actions resulting from an expression using the interpreter"
72 , exprArgCmd ["x"] ExecVal "Execute IO actions resulting from an expression using the interpreter"
73 , (["c", "compile"], FileArg, "Compile to an executable [codegen] <filename>", cmd_compile)
73 , (["c", "compile"], FileArg, "Compile to an executable [codegen] <filename>", cmd_compile)
74− , noArgCmd ["exec", "execute"] Execute "Compile to an executable and run"
74+ , (["exec", "execute"], OptionalArg ExprArg, "Compile to an executable and run", cmd_execute)
75 , (["dynamic"], FileArg, "Dynamically load a C library (similar to %dynamic)", cmd_dynamic)
75 , (["dynamic"], FileArg, "Dynamically load a C library (similar to %dynamic)", cmd_dynamic)
76 , (["dynamic"], NoArg, "List dynamically loaded C libraries", cmd_dynamic)
76 , (["dynamic"], NoArg, "List dynamically loaded C libraries", cmd_dynamic)
77 , noArgCmd ["?", "h", "help"] Help "Display this help text"
77 , noArgCmd ["?", "h", "help"] Help "Display this help text"
@@ -276,6 +276,14 @@ cmd_consolewidth name = do
276 <|> do discard (P.symbol "infinite"); return InfinitelyWide
276 <|> do discard (P.symbol "infinite"); return InfinitelyWide
277 <|> do n <- fmap fromInteger P.natural; return (ColsWide n)
277 <|> do n <- fmap fromInteger P.natural; return (ColsWide n)
279+cmd_execute :: String -> P.IdrisParser (Either String Command)
280+cmd_execute name = do
281+ tm <- option maintm (P.fullExpr defaultSyntax)
282+ return (Right (Execute tm))
284+ maintm = PRef (fileFC "(repl)") (sNS (sUN "main") ["Main"])
279cmd_dynamic :: String -> P.IdrisParser (Either String Command)
287cmd_dynamic :: String -> P.IdrisParser (Either String Command)
280cmd_dynamic name = do
288cmd_dynamic name = do
281 let emptyArgs = noArgs ListDynamic name
289 let emptyArgs = noArgs ListDynamic name