aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/Main.hs
blob: 8731b7cbee99f2fd56e01c36599bc1231352e410 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
module Main where

import           Eval
import           Helper                         ( ArgMode(..)
                                                , Args(..)
                                                )
import           Options.Applicative

mode :: Parser ArgMode
mode =
  flag' ArgEvalBblc
        (long "eval-bblc" <> short 'e' <> help "Evaluate file with BLC bits")
    <|> flag'
          ArgEvalBlc
          (long "eval-blc" <> short 'E' <> help "Evaluate file with ASCII BLC")
    <|> flag' ArgDumpBblc
              (long "dump-bblc" <> short 'b' <> help "Dump file as BLC bits")
    <|> flag' ArgDumpBlc
              (long "dump-blc" <> short 'B' <> help "Dump file as ASCII BLC")

args :: Parser Args
args =
  Args
    <$> (mode <|> pure ArgEval)
    <*> switch (long "yolo" <> short 'y' <> help "Don't run tests")
    <*> switch (long "verbose" <> short 'v' <> help "Increase verbosity")
    <*> strOption
          (long "target" <> short 't' <> metavar "TARGET" <> value "" <> help
            "Compile to target using BLoC and BLoCade"
          )
    <*> strOption
          (  long "reducer"
          <> short 'r'
          <> metavar "REDUCER"
          <> value "HigherOrder"
          <> help "Reducer (currently RKNL, ION, or HigherOrder)"
          )
    <*> optional (argument str (metavar "PATH" <> help "Path to file"))

main :: IO ()
main = evalMain =<< execParser opts
 where
  opts =
    info (args <**> helper) (fullDesc <> header "bruijn programming language")