Skip to content

Commit d4ee635

Browse files
Merge pull request #230 from andrew-johnson-4/nominal-strings
nominal strings work
2 parents f6abf49 + 2e34125 commit d4ee635

File tree

10 files changed

+9670
-9785
lines changed

10 files changed

+9670
-9785
lines changed

BOOTSTRAP/cli.s

+9,653-9,764
Large diffs are not rendered by default.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lambda_mountain"
3-
version = "1.11.93"
3+
version = "1.11.94"
44
authors = ["Andrew <andrew@subarctic.org>"]
55
license = "MIT"
66
description = "Lambda Mountain"

PRODUCTION/assemble.lm

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ assemble := λprogram . (
3737
(typecheck-ascript( (GlobalVariable 'argc) (parse-type 'U64+GlobalVariable) ))
3838
)))
3939
(set global_ctx (context::bind( global_ctx 'argv
40-
(typecheck-ascript( (GlobalVariable 'argv) (parse-type 'U8[?][?]+GlobalVariable) ))
40+
(typecheck-ascript( (GlobalVariable 'argv) (parse-type 'String[?]+GlobalVariable) ))
4141
)))
4242
(set assemble-argv-referenced True)
4343
(set preview_program pc)

PRODUCTION/codegen-strict.lm

+4-6
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,8 @@ compile-expr-strict := λctx e offset used . (tail(
8989
(match (typecheck-slot( (typecheck-lookup r) Array )) (
9090
()
9191
( (Array( x '? )) (
92-
(if (typecheck-unify-implies( x U8 )) () (
93-
(if (typecheck-unify-implies( x '? )) () (
94-
(set deref True)
95-
))
92+
(if (typecheck-unify-implies( x '? )) () (
93+
(set deref True)
9694
))
9795
))
9896
))
@@ -243,7 +241,7 @@ compile-expr-strict := λctx e offset used . (tail(
243241
)))
244242
( (App( (App( (Literal :) (Literal lval) )) ltype )) (tail(
245243
(set ltype (typecheck-infer-type-compound ltype))
246-
(if (typecheck-unify-args( (Array( U8 '? )) ltype )) (
244+
(if (typecheck-unify-args( String ltype )) (
247245
(local uid)
248246
(set uid (strict-declare-cstring( lval )))
249247
(set e1 (expr::set-expr( (expr::new ()) uid )))
@@ -268,7 +266,7 @@ compile-expr-strict := λctx e offset used . (tail(
268266
e1
269267
)))
270268
( (Literal lval) (tail(
271-
(if (typecheck-unify-args( (Array( U8 '? )) (typecheck-lookup e) )) (
269+
(if (typecheck-unify-args( String (typecheck-lookup e) )) (
272270
(local uid)
273271
(set uid (strict-declare-cstring( lval )))
274272
(set e1 (expr::set-expr( (expr::new ()) uid )))

PRODUCTION/typecheck.lm

+3-5
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ typecheck-infer-type-expr := λe . (match e (
658658
))
659659
( (Global( 'main (Lambda( _ _ )) )) (tail(
660660
(set typecheck-global-context ( typecheck-global-context (Global( 'argc (parse-type 'U64+GlobalVariable) )) ))
661-
(set typecheck-global-context ( typecheck-global-context (Global( 'argv (parse-type 'U8[?][?]+GlobalVariable) )) ))
661+
(set typecheck-global-context ( typecheck-global-context (Global( 'argv (parse-type 'String[?]+GlobalVariable) )) ))
662662
)))
663663
( (Global( gln (Lambda( glp (App( (App( (Literal ':) _ )) rtype )) )) )) (tail(
664664
(local lt)
@@ -820,10 +820,8 @@ typecheck-infer-expr := λctx e used . (tail(
820820
(match (typecheck-slot( (typecheck-lookup r) Array )) (
821821
()
822822
( (Array( x '? )) (
823-
(if (typecheck-unify-implies( x U8 )) () (
824-
(if (typecheck-unify-implies( x '? )) () (
825-
(set rtype x)
826-
))
823+
(if (typecheck-unify-implies( x '? )) () (
824+
(set rtype x)
827825
))
828826
))
829827
))

STDLIB/default-instruction-set.lm

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ fragment mov := λ(: src Reg16)(: dst LocalVariable). (: (.program( \t 'mov \s '
189189
fragment mov := λ(: src Reg32)(: dst LocalVariable). (: (.program( \t 'mov \s '% (.expression src) , \s (.expression dst) \[ '%rbp \] \n )) Nil);
190190
fragment mov := λ(: src Reg64)(: dst LocalVariable). (: (.program( \t 'mov \s '% (.expression src) , \s (.expression dst) \[ '%rbp \] \n )) Nil);
191191

192-
fragment mov := λ(: src Constant+U8[])(: dst LocalVariable). (: (.program(
192+
fragment mov := λ(: src Constant+String)(: dst LocalVariable). (: (.program(
193193
\t 'movq \s '$ (.expression src) , \s (.expression dst) \[ '%rbp \] \n
194194
)) Nil);
195195

STDLIB/default-primitives.lm

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ fragment type I8; size I8 1; atom suffix I8 i8;
77
fragment type I16; size I16 2; atom suffix I16 i16;
88
fragment type I32; size I32 4; atom suffix I32 i32;
99
fragment type I64; size I64 8; atom suffix I64 i64;
10-
atom suffix U8[] _s;
10+
size String 8; atom suffix String _s;
1111

1212
fragment [] := λ(: l GlobalVariable+Array<x,?>)(: r GlobalVariable+U64). (: (
1313
(.program (

STDLIB/default-stdlib.lm

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
type S (SNil)
3-
| (SAtom( U8[] ))
3+
| (SAtom( String ))
44
| (SCons( S[] , S[] ))
55
| (SPointer( ?[] ));
66

@@ -31,7 +31,7 @@ print := λ(: x S). (: (tail(
3131
()
3232
)) Nil);
3333

34-
fail := λ(: msg Array<U8,?>). (: (tail(
34+
fail := λ(: msg String). (: (tail(
3535
(print msg)
3636
(exit 1u64)
3737
)) Nil);
@@ -42,7 +42,7 @@ exit := λ(: code U64). (: (tail(
4242
(syscall())
4343
)) Nil);
4444

45-
print := λ(: x Array<U8,?>). (: (tail(
45+
print := λ(: x String). (: (tail(
4646
(mov( x R15 ))
4747
(mov( 0u64 RDX )) # data length
4848
(gensym-label begin-count)
@@ -176,7 +176,7 @@ print := λ(: x I8). (: (tail(
176176
(print( (: R15 Reg64+I64) ))
177177
)) Nil);
178178

179-
== := λ(: l U8[])(: r U8[]). (: (tail(
179+
== := λ(: l String)(: r String). (: (tail(
180180
(let c1 0u8)
181181
(let c2 0u8)
182182
(gensym-label start)

STRICT/cli.lm

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ config-target := 'tmp.s_s;
2222
type CompileMode ModeTokenize | ModeParse | ModePreprocess | ModeTypecheck | ModeCompile;
2323
config-mode := (: ModeCompile CompileMode);
2424

25-
main := λ(: argc U64)(: argv U8[][]).(tail(
25+
main := λ(: argc U64)(: argv String[]).(tail(
2626
(let argi 1u64)
2727
(let input SNil)
2828
(while (<( argi argc )) (

STRICT/tokenize.lm

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
type Tokens EOF;
33

4-
tokenize := λ(: fp U8[]). (: (tail(
4+
tokenize := λ(: fp String). (: (tail(
55
()
66
()
77
)) Nil);

0 commit comments

Comments
 (0)