File tree Expand file tree Collapse file tree 6 files changed +39
-47
lines changed Expand file tree Collapse file tree 6 files changed +39
-47
lines changed Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " lambda_mountain"
3
- version = " 1.11.79 "
3
+ version = " 1.11.80 "
4
4
authors = [" Andrew <andrew@subarctic.org>" ]
5
5
license = " MIT"
6
6
description = " Lambda Mountain"
Original file line number Diff line number Diff line change 1
1
2
2
nostd : prod
3
- ./production --nostd -o tmp.s tests/strict/match1 .lm
3
+ ./production --nostd -o tmp.s tests/strict/match2 .lm
4
4
as -o tmp.o tmp.s
5
5
ld -o tmp tmp.o
6
6
./tmp && echo $?
Original file line number Diff line number Diff line change @@ -183,6 +183,12 @@ fragment == := λ(: l U64+GlobalVariable)(: r U64+Literal+Constant). (: (
183
183
))
184
184
(.expression( 'je ))
185
185
) BranchConditional);
186
+ fragment == := λ(: l U64+LocalVariable)(: r U64+Literal+Constant). (: (
187
+ (.program (
188
+ \t 'cmp \s '$ (.expression r) , (.expression l) \[ '%rbp \] \n
189
+ ))
190
+ (.expression( 'je ))
191
+ ) BranchConditional);
186
192
fragment == := λ(: l U64+Literal+Constant)(: r U64+GlobalVariable). (: (
187
193
(.program (
188
194
\t 'mov \s '$ (.expression r) , '%r15 \n
Original file line number Diff line number Diff line change @@ -23,48 +23,7 @@ macro ('match-pats-condition term (:Variable: v)) (
23
23
(tail( (let v term) (branchtrue()) ))
24
24
);
25
25
26
- #macro ('match-pats( term matched return (ps (lhs rhs)) )) (
27
- # (match-pats( term matched return ps ))
28
- # (if matched () (
29
- # (set matched True)
30
- # (match-destructure( term matched return lhs ))
31
- # (if matched (
32
- # (set return rhs)
33
- # ) ())
34
- # ))
35
- #);
36
- #macro ('match-destructure( term matched return () )) (
37
- # (if matched (
38
- # (if term (
39
- # (set matched ())
40
- # ) ())
41
- # ) ())
42
- #);
43
- #macro ('match-destructure( term matched return (:Literal: l) )) (
44
- # (if matched (
45
- # (if (is-atom term) (
46
- # (if (eq( term l )) () (
47
- # (set matched ())
48
- # ))
49
- # ) (
50
- # (set matched ())
51
- # ))
52
- # ) ())
53
- #);
54
- #macro ('match-destructure( term matched return (:Variable: v) )) (
55
- # (let v term)
56
- #);
57
- #macro ('match-destructure( term matched return (l r) )) (
58
- # (if matched (
59
- # (if (is-cons term) (
60
- # (let (uuid x) term)
61
- # (set term (head (uuid x)))
62
- # (match-destructure( term matched return l ))
63
- # (set term (tail (uuid x)))
64
- # (match-destructure( term matched return r ))
65
- # (set term (uuid x))
66
- # ) (
67
- # (set matched ())
68
- # ))
69
- # ) ())
70
- #);
26
+ macro ('match-pats-condition term (:Literal: l)) (
27
+ (==( term l ))
28
+ );
29
+
Original file line number Diff line number Diff line change
1
+
2
+ import STDLIB/default-instruction-set.lm;
3
+ import STDLIB/default-primitives.lm;
4
+ import STDLIB/default-rules.lm;
5
+ import STDLIB/default-stdlib.lm;
6
+
7
+ main := (tail(
8
+ (match 1u64 (
9
+ ()
10
+ (1u64 (print 1u64))
11
+ (2u64 (print 2u64))
12
+ (3u64 (print 3u64))
13
+ ))
14
+ (match 2u64 (
15
+ ()
16
+ (1u64 (print 1u64))
17
+ (2u64 (print 2u64))
18
+ (3u64 (print 3u64))
19
+ ))
20
+ (match 3u64 (
21
+ ()
22
+ (1u64 (print 1u64))
23
+ (2u64 (print 2u64))
24
+ (3u64 (print 3u64))
25
+ ))
26
+ ));
Original file line number Diff line number Diff line change
1
+ 123
You can’t perform that action at this time.
0 commit comments