@@ -6,32 +6,40 @@ import STDLIB/default-stdlib.lm;
6
6
7
7
import STRICT/utility.lm;
8
8
9
- config-strict := 0u8;
9
+ config-strict := True;
10
+ config-preprocess := True;
11
+ config-target := 'tmp.s_s;
10
12
11
- type CompileMode Tokenize | Parse | Compile ;
12
- config-mode := Compile ;
13
+ type CompileMode ModeTokenize | ModeParse | ModeTypecheck | ModeCompile ;
14
+ config-mode := ModeCompile ;
13
15
14
16
main := λ(: argc U64)(: argv U8[][]).(tail(
15
17
(let argi 0u64)
16
18
(let input SNil)
17
19
(while (<( argi argc )) (
18
- (set input (SCons(
19
- (close (SAtom(
20
- ([]( argv argi ))
20
+ (match ([]( argv argi )) (
21
+ ()
22
+ ('--tokenize_s (set config-mode ModeTokenize))
23
+ ('--parse_s (set config-mode ModeParse))
24
+ ('--typecheck_s (set config-mode ModeTypecheck))
25
+ ('--compile_s (set config-mode ModeCompile))
26
+ ('--strict_s (set config-strict True))
27
+ ('--gradual_s (set config-strict False))
28
+ ('--macro_s (set config-preprocess True))
29
+ ('--nomacro_s (set config-preprocess False))
30
+ ('-o_s (tail(
31
+ (set argi (+( argi 1u64 )))
32
+ (set input (SCons(
33
+ (close input)
34
+ (close (SAtom([]( argv argi ))))
35
+ )))
21
36
)))
22
- (close input)
23
- )))
37
+ (fp (set input (SCons(
38
+ (close input)
39
+ (close (SAtom( fp )))
40
+ ))))
41
+ ))
24
42
(set argi (+( argi 1u64 )))
25
43
))
26
44
(print input)
27
- # (print (==( ([]( argv argi )) (: '--tokenize U8[]) )) )
28
- # if set_target { config_target().lock().unwrap().set(arg); }
29
- # else if arg=="--tokenize" {unsafe{ CONFIG_MODE = CompileMode::Tokenize; }}
30
- # else if arg=="--parse" {unsafe{ CONFIG_MODE = CompileMode::Parse; }}
31
- # else if arg=="--typecheck" {unsafe{ CONFIG_MODE = CompileMode::Typecheck; }}
32
- # else if arg=="--compile" {unsafe{ CONFIG_MODE = CompileMode::Compile; }}
33
- # else if arg=="--strict" {unsafe{ CONFIG_STRICT = true; }}
34
- # else if arg=="--gradual" {unsafe{ CONFIG_STRICT = false; }}
35
- # else if arg=="--noprep" {unsafe{ CONFIG_PREPROCESS = false; }}
36
- # else if arg=="-o" { set_target = true; }
37
45
));
0 commit comments