Skip to content

Strict compiler dev 20 #208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 3, 2024
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
47 changes: 26 additions & 21 deletions BOOTSTRAP/cli.s
Original file line number Diff line number Diff line change
Expand Up @@ -59427,32 +59427,16 @@ uuid_0000000000000355:
call __s2i_C___
mov %r12, -184(%rbp)
mov %r13, -192(%rbp)
mov -184(%rbp),%r12
mov -192(%rbp),%r13
call inv
mov %r12, -168(%rbp)
mov %r13, -176(%rbp)
uuid_0000000000000356:
mov -184(%rbp),%r12
mov -192(%rbp),%r13
cmp $0, %r12
je uuid_0000000000000357
mov $uuid_0000000000000316, %r12
mov $0, %r13
call __s2i_C___
push %r12
push %r13
mov -168(%rbp),%r12
mov -176(%rbp),%r13
call uuid_0000000000000003
mov %r12, 0(%r8)
mov %r13, 8(%r8)
pop %r13
pop %r12
push %r8
call uuid_0000000000000003
mov %r12, 0(%r8)
mov %r13, 8(%r8)
mov %r8, %r12
pop %r13
call add
mov %r12, -168(%rbp)
mov %r13, -176(%rbp)
mov -136(%rbp),%r12
mov -144(%rbp),%r13
push %r12
Expand Down Expand Up @@ -59794,6 +59778,27 @@ uuid_0000000000000356:
call __s2i_C___
push %r12
push %r13
mov -168(%rbp),%r12
mov -176(%rbp),%r13
call uuid_0000000000000003
mov %r12, 0(%r8)
mov %r13, 8(%r8)
pop %r13
pop %r12
push %r8
call uuid_0000000000000003
mov %r12, 0(%r8)
mov %r13, 8(%r8)
mov %r8, %r12
pop %r13
call add
mov %r12, -168(%rbp)
mov %r13, -176(%rbp)
mov $uuid_000000000000001f, %r12
mov $0, %r13
call __s2i_C___
push %r12
push %r13
mov -152(%rbp),%r12
mov -160(%rbp),%r13
call uuid_0000000000000003
Expand Down
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.70"
version = "1.11.71"
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/cc1.lm
./production --nostd -o tmp.s tests/strict/cc2.lm
as -o tmp.o tmp.s
ld -o tmp tmp.o
./tmp && echo $?
Expand Down
5 changes: 3 additions & 2 deletions PRODUCTION/stack.lm
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,14 @@ stack-call := λ ctx function-name function-args offset . (tail(
)))
( copy-size (tail(
(set copy-size (s2i copy-size))
(set copy-offset (inv( copy-size )))
(while copy-size (
(set copy-offset (add( (s2i '-8) copy-offset )))
(set copy-bytes ( copy-bytes
\t 'mov \s (i2s( src-offset )) \[ '%rbp \] , \s '%rax \n
\t 'mov \s '%rax , \s (i2s( copy-offset )) \[ '%rbp \] \n
))
(set src-offset (add( (s2i 8) src-offset )))
(set copy-offset (add( (s2i '8) copy-offset )))
(set src-offset (add( (s2i '8) src-offset )))
(set copy-size (add( (s2i '-8) copy-size )))
))
)))
Expand Down
5 changes: 1 addition & 4 deletions STDLIB/default-instruction-set.lm
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ fragment mov := λ(: src LocalVariable+Sized<size>)(: dst LocalVariable+Sized<si
\t 'movq \s (+( (.expression src) (*( word-offset 8 )) )) \[ '%rbp \] , \s '%r15 \n
\t 'movq \s '%r15 , \s (+(
(.expression dst)
(+(
(+( size -8 ))
(inv( (*( word-offset 8 )) ))
))
(*( word-offset 8 ))
)) \[ '%rbp \] \n
)))
) Nil);
Expand Down
15 changes: 8 additions & 7 deletions STDLIB/default-stdlib.lm
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@ print := λ(: x S). (: (tail(
(print (.1 (as x SAtom)))
) (
(if (==( (.0 x) 1u64 )) (tail(
(let c SNil)
# (let c SNil)
(print '\[_s)
(print( (as (.1 (as x SCons)) U64) ))
(mov( (.1 (as x SCons)) 0u64 c ))
(print c)
# (print( (as (.1 (as x SCons)) U64) ))
# (mov( (.1 (as x SCons)) 0u64 c ))
# (print c)
(print '\s_s)
(print( (as (.2 (as x SCons)) U64) ))
(mov( (.2 (as x SCons)) 0u64 c ))
(print c)
# (print( (as (.2 (as x SCons)) U64) ))
# (mov( (.2 (as x SCons)) 0u64 c ))
# (print c)
(print '\]_s)
()
)) (tail(
(print '[_s)
(print (as (.1 (as x SPointer)) U64))
Expand Down
17 changes: 6 additions & 11 deletions STRICT/cli.lm
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,12 @@ config-mode := Compile;
main := λ(: argc U64)(: argv U8[][]).(tail(
# (let argi 0u64)
(let input_l (SAtom( 'an-atom_s )))
(let input_o SNil)
(let close_l 0u64)
(push (close( input_l )))
(pop( close_l ))
(mov( close_l R8 ))
(mov( (as R8 S[]) 0u64 input_o ))
(print input_o)
# (push (close( input_r )))
# (pop( close_r ))
# (let input (SCons( (as close_l S[]) (as close_r S[]) )))
# (print input)
(let input_r (SPointer( 'test_s )))
(let input (SCons(
(close input_l)
(close input_r)
)))
(print input)
# (while (<( argi argc )) (
# (if (==( ([]( argv argi )) '--tokenize_s )) (
# (print '--tokenize_s)
Expand Down
18 changes: 18 additions & 0 deletions tests/strict/cc2.lm
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

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

echo := λ(: x U64). (: (
x
) U64);

main := (
(let x SNil)
# (let x (SCons(
# (close(SAtom( 'an-atom_s )))
# (close(SNil))
# )))
(print x)
);
Empty file added tests/strict/cc2.lm.out
Empty file.