Skip to content

Commit 8259491

Browse files
make a close operator for tokens
1 parent 0606298 commit 8259491

File tree

5 files changed

+18
-14
lines changed

5 files changed

+18
-14
lines changed

STDLIB/default-stdlib.lm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ close := λ(: x S). (: (tail(
1010
(as R8 S[])
1111
)) S[]);
1212

13+
close := λ(: x Tokens). (: (tail(
14+
(mov( (malloc(sizeof Tokens)) R8 ))
15+
(mov( x 0u64 (as R8 Tokens[]) ))
16+
(as R8 Tokens[])
17+
)) Tokens[]);
18+
1319
print := λ(: x S). (: (tail(
1420
(match x (
1521
()

STRICT/cli.lm

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,19 @@ main := λ(: argc U64)(: argv String[]).(tail(
6464
(match config-mode (
6565
()
6666
( ModeTokenize () )
67-
( ModeParse (parse ast-tokenized-program) )
67+
( ModeParse (parse()) )
6868
( ModePreprocess (tail(
69-
(parse ast-tokenized-program)
70-
(preprocess ast-parsed-program)
69+
(parse())
70+
(preprocess())
7171
)))
7272
( ModeTypecheck (tail(
73-
(parse ast-tokenized-program)
74-
(preprocess ast-parsed-program)
73+
(parse())
74+
(preprocess())
7575
(typecheck())
7676
)))
7777
( ModeCompile (tail(
78-
(parse ast-tokenized-program)
79-
(preprocess ast-parsed-program)
78+
(parse())
79+
(preprocess())
8080
(typecheck())
8181
(compile())
8282
)))

STRICT/parse.lm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
parse := λ(: fp Tokens). (: (tail(
2+
parse := λ. (: (tail(
33
()
44
()
55
)) Nil);

STRICT/preprocess.lm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
preprocess := λ(: program AST). (: (tail(
2+
preprocess := λ. (: (tail(
33
()
44
()
55
)) Nil);

STRICT/tokenize.lm

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11

2-
type Tokens EOF;
2+
type Tokens EOF | (HeadOrder( String , Tokens[] )) | (TailOrder( Tokens[] , String ));
33

44
tokenize := λ(: fp String). (: (tail(
5-
(print 'Tokenize:\s_s)
6-
(print fp)
7-
(print '\n_s)
8-
(print (read-file fp))
5+
(let text (read-file fp))
6+
(print text)
97
)) Nil);

0 commit comments

Comments
 (0)