Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lambda_mountain"
version = "1.11.87"
version = "1.11.88"
authors = ["Andrew <andrew@subarctic.org>"]
license = "MIT"
description = "Lambda Mountain"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

nostd: prod
./production --nostd -o tmp.s tests/strict/match6.lm
./production --nostd -o tmp.s tests/strict/match7.lm
as -o tmp.o tmp.s
ld -o tmp tmp.o
./tmp && echo $?
Expand Down
60 changes: 30 additions & 30 deletions STDLIB/default-rules.lm
Original file line number Diff line number Diff line change
Expand Up @@ -32,47 +32,47 @@ macro ('match-pats-condition( term (:Tag: l lt) )) (
);

macro ('match-pats-condition( term ((:Tag: l lt) ( x1 )) )) (tail(
(let ok Trueu8)
(if (==( (.0( term )) l )) () (set ok Falseu8))
(if (match-pats-condition( (.1( (as term lt) )) x1 )) () (set ok Falseu8))
(==( ok Trueu8 ))
(let (uuid ok) Trueu8)
(if (==( (.0( term )) l )) () (set (uuid ok) Falseu8))
(if (match-pats-condition( (.1( (as term lt) )) x1 )) () (set (uuid ok) Falseu8))
(==( (uuid ok) Trueu8 ))
));

macro ('match-pats-condition( term ((:Tag: l lt) ( x2 x1 ) ))) (tail(
(let ok Trueu8)
(if (==( (.0( term )) l )) () (set ok Falseu8))
(if (match-pats-condition( (.1( (as term lt) )) x1 )) () (set ok Falseu8))
(if (match-pats-condition( (.2( (as term lt) )) x2 )) () (set ok Falseu8))
(==( ok Trueu8 ))
(let (uuid ok) Trueu8)
(if (==( (.0( term )) l )) () (set (uuid ok) Falseu8))
(if (match-pats-condition( (.1( (as term lt) )) x1 )) () (set (uuid ok) Falseu8))
(if (match-pats-condition( (.2( (as term lt) )) x2 )) () (set (uuid ok) Falseu8))
(==( (uuid ok) Trueu8 ))
));

macro ('match-pats-condition( term ((:Tag: l lt) ( x3 x2 x1 ) ))) (tail(
(let ok Trueu8)
(if (==( (.0( term )) l )) () (set ok Falseu8))
(if (match-pats-condition( (.1( (as term lt) )) x1 )) () (set ok Falseu8))
(if (match-pats-condition( (.2( (as term lt) )) x2 )) () (set ok Falseu8))
(if (match-pats-condition( (.3( (as term lt) )) x3 )) () (set ok Falseu8))
(==( ok Trueu8 ))
(let (uuid ok) Trueu8)
(if (==( (.0( term )) l )) () (set (uuid ok) Falseu8))
(if (match-pats-condition( (.1( (as term lt) )) x1 )) () (set (uuid ok) Falseu8))
(if (match-pats-condition( (.2( (as term lt) )) x2 )) () (set (uuid ok) Falseu8))
(if (match-pats-condition( (.3( (as term lt) )) x3 )) () (set (uuid ok) Falseu8))
(==( (uuid ok) Trueu8 ))
));

macro ('match-pats-condition( term ((:Tag: l lt) ( x4 x3 x2 x1 ) ))) (tail(
(let ok Trueu8)
(if (==( (.0( term )) l )) () (set ok Falseu8))
(if (match-pats-condition( (.1( (as term lt) )) x1 )) () (set ok Falseu8))
(if (match-pats-condition( (.2( (as term lt) )) x2 )) () (set ok Falseu8))
(if (match-pats-condition( (.3( (as term lt) )) x3 )) () (set ok Falseu8))
(if (match-pats-condition( (.4( (as term lt) )) x4 )) () (set ok Falseu8))
(==( ok Trueu8 ))
(let (uuid ok) Trueu8)
(if (==( (.0( term )) l )) () (set (uuid ok) Falseu8))
(if (match-pats-condition( (.1( (as term lt) )) x1 )) () (set (uuid ok) Falseu8))
(if (match-pats-condition( (.2( (as term lt) )) x2 )) () (set (uuid ok) Falseu8))
(if (match-pats-condition( (.3( (as term lt) )) x3 )) () (set (uuid ok) Falseu8))
(if (match-pats-condition( (.4( (as term lt) )) x4 )) () (set (uuid ok) Falseu8))
(==( (uuid ok) Trueu8 ))
));

macro ('match-pats-condition( term ((:Tag: l lt) ( x5 x4 x3 x2 x1 ) ))) (tail(
(let ok Trueu8)
(if (==( (.0( term )) l )) () (set ok Falseu8))
(if (match-pats-condition( (.1( (as term lt) )) x1 )) () (set ok Falseu8))
(if (match-pats-condition( (.2( (as term lt) )) x2 )) () (set ok Falseu8))
(if (match-pats-condition( (.3( (as term lt) )) x3 )) () (set ok Falseu8))
(if (match-pats-condition( (.4( (as term lt) )) x4 )) () (set ok Falseu8))
(if (match-pats-condition( (.5( (as term lt) )) x5 )) () (set ok Falseu8))
(==( ok Trueu8 ))
(let (uuid ok) Trueu8)
(if (==( (.0( term )) l )) () (set (uuid ok) Falseu8))
(if (match-pats-condition( (.1( (as term lt) )) x1 )) () (set (uuid ok) Falseu8))
(if (match-pats-condition( (.2( (as term lt) )) x2 )) () (set (uuid ok) Falseu8))
(if (match-pats-condition( (.3( (as term lt) )) x3 )) () (set (uuid ok) Falseu8))
(if (match-pats-condition( (.4( (as term lt) )) x4 )) () (set (uuid ok) Falseu8))
(if (match-pats-condition( (.5( (as term lt) )) x5 )) () (set (uuid ok) Falseu8))
(==( (uuid ok) Trueu8 ))
));

14 changes: 6 additions & 8 deletions STDLIB/default-stdlib.lm
Original file line number Diff line number Diff line change
Expand Up @@ -194,17 +194,15 @@ print := λ(: x I8). (: (tail(
(label start )
(mov( R8 0u64 c1 ))
(mov( R9 0u64 c2 ))
(if (==( c1 c2 )) () (jmp end-false))
(if (==( c1 0u8 )) () (jmp end-true))
(if (==( c1 c2 )) (mov( 1u64 RAX )) (mov( 0u64 RAX )) )
(cmp( 0u64 RAX ))
(je end)
(if (==( c1 0u8 )) (mov( 1u64 RAX )) (mov( 0u64 RAX )) )
(cmp( 1u64 RAX ))
(je end)
(inc R8)
(inc R9)
(jmp start)
(label end-true)
(mov( 1u64 RAX ))
(jmp( end ))
(label end-false)
(mov( 0u64 RAX ))
(jmp( end ))
(label end)
(as RAX U64)
)) U64);
Expand Down
19 changes: 9 additions & 10 deletions STRICT/cli.lm
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,19 @@ main := λ(: argc U64)(: argv U8[][]).(tail(
('--gradual_s (set config-strict Falseu8))
('--macro_s (set config-preprocess Trueu8))
('--nomacro_s (set config-preprocess Falseu8))
('-o_s (tail(
(set argi (+( argi 1u64 )))
(set input (SCons(
(close input)
(close (SAtom([]( argv argi ))))
)))
)))
(fp (tail(
(print fp)
# ('-o_s (tail(
# (set argi (+( argi 1u64 )))
# (set input (SCons(
# (close input)
# (close (SAtom([]( argv argi ))))
# )))
# )))
(fp (
(set input (SCons(
(close input)
(close (SAtom( fp )))
)))
)))
))
))
(set argi (+( argi 1u64 )))
))
Expand Down
22 changes: 22 additions & 0 deletions tests/strict/match7.lm
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

import STDLIB/default-instruction-set.lm;
import STDLIB/default-primitives.lm;
import STDLIB/default-rules.lm;
import STDLIB/default-stdlib.lm;

import STRICT/utility.lm;

config-preprocess := 2u8;

main := λ(: argc U64)(: argv U8[][]).(tail(
(print( (==( '--macro_s '--macro_s )) ))
(print( (==( '--macro_s '--nomacro_s )) ))
(print( (==( '--nomacro_s '--macro_s )) ))
(print( (==( '--nomacro_s '--nomacro_s )) ))
(match '--nomacro_s (
()
('--macro_s (set config-preprocess 1u8))
('--nomacro_s (set config-preprocess 0u8))
))
(print config-preprocess)
));
1 change: 1 addition & 0 deletions tests/strict/match7.lm.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ok