9import IRTS.CodegenJavaScript
11import System.Environment
16data Opts = Opts { really :: Bool
17 , inputs :: [FilePath]
21showUsage = do putStrLn "A code generator which is intended to be called by the compiler, not by a user."
22 putStrLn "To call the code generator manually, pass the --yes-really option.\n"
23 putStrLn "Usage: idris-codegen-c [--yes-really] <ibc-files> [-o <output-file>]"
27getOpts = do xs <- getArgs
28 return $ process (Opts False [] "main.js") xs
30 process opts ("--yes-really":xs) = process (opts { really = True }) xs
31 process opts ("-o":o:xs) = process (opts { output = o }) xs
32 process opts (x:xs) = process (opts { inputs = x:inputs opts }) xs
33 process opts [] = opts
35jsMain :: Opts -> Idris ()
36jsMain opts = do elabPrims
37 loadInputs (inputs opts) Nothing
39 ir <- compile (Via "javascript") (output opts) (Just mainProg)
40 runIO $ codegenJavaScript ir
43main = do opts <- getOpts
44 if (null (inputs opts))
46 else if (not $ really opts)
47 then do putStrLn "This code generator is intended to be called by the Idris compiler. \
48 \Please pass Idris the '--codegen' flag to choose a backend."
50 else runMain (jsMain opts)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list