@@ -71,7 +71,7 @@ parserCommandsForHelp =
7171 , noArgCmd ["proofs"] Proofs "Show available proofs"
7272 , exprArgCmd ["x"] ExecVal "Execute IO actions resulting from an expression using the interpreter"
7373 , (["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)
7575 , (["dynamic"], FileArg, "Dynamically load a C library (similar to %dynamic)", cmd_dynamic)
7676 , (["dynamic"], NoArg, "List dynamically loaded C libraries", cmd_dynamic)
7777 , noArgCmd ["?", "h", "help"] Help "Display this help text"
@@ -276,6 +276,14 @@ cmd_consolewidth name = do
276276 <|> do discard (P.symbol "infinite"); return InfinitelyWide
277277 <|> do n <- fmap fromInteger P.natural; return (ColsWide n)
278278
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))
283+ where
284+ maintm = PRef (fileFC "(repl)") (sNS (sUN "main") ["Main"])
285+
286+
279287cmd_dynamic :: String -> P.IdrisParser (Either String Command)
280288cmd_dynamic name = do
281289 let emptyArgs = noArgs ListDynamic name