Skip to content

Commit

Permalink
Merge pull request #1127 from andrew-johnson-4/infer-lm-struct-23mf
Browse files Browse the repository at this point in the history
Infer lm struct 23mf
  • Loading branch information
andrew-johnson-4 authored Jan 19, 2025
2 parents bf93108 + f801411 commit fd24671
Show file tree
Hide file tree
Showing 14 changed files with 22,062 additions and 22,551 deletions.
44,468 changes: 22,047 additions & 22,421 deletions BOOTSTRAP/cli.c

Large diffs are not rendered by default.

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.20.29"
version = "1.20.30"
authors = ["Andrew <[email protected]>"]
license = "MIT"
description = "Typed Macro Assembler (backed by Coq proofs-of-correctness)"
Expand Down
2 changes: 1 addition & 1 deletion PLUGINS/BACKEND/C/compile-c.lm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ plugins-backend-c-compile := λ . (: (
global-ctx k kt fragment
)))
) (
(let clean-tt (without-representation kt))
(let clean-tt (.without-tag kt))
(let mid (mangle-identifier( k clean-tt )))
(set fragment (.set( fragment 'fragment-type_s (SAtom 'Global_s) )))
(set fragment (.set( fragment 'expression_s (SAtom mid) )))
Expand Down
2 changes: 1 addition & 1 deletion PLUGINS/BACKEND/C/compile-global.lm
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ compile-global-c := λ(: ctx FContext)(: k String)(: term AST). (: (
(set assemble-text-section (SCons( (close assemble-text-section) (close text) )))
)))
( t (
(let clean-tt (without-representation kt))
(let clean-tt (.without-tag kt))
(let mid (mangle-identifier( k clean-tt )))

(let e (compile-expr( ctx t 0_i64 Used )))
Expand Down
1 change: 0 additions & 1 deletion SRC/denormalize.lm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
denormalize := λ(: tt Type). (: (
(set tt (with-size tt))
(set tt (with-tag tt))
(set tt (with-platform-props tt))
(set tt (enrich-quick-prop tt))
tt
) Type);
3 changes: 0 additions & 3 deletions SRC/index-types.lm
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,12 @@ import SRC/has-forward.lm;
import SRC/with-tag.lm;
import SRC/with-phi.lsts;
import SRC/with-size.lm;
import SRC/with-platform-props.lm;

import SRC/without-t.lm;
import SRC/without-phi.lsts;
import SRC/without-constructor.lm;
import SRC/without-representation.lm;
import SRC/without-size-unless-class.lm;
import SRC/without-size.lm;
import SRC/without-platform-props.lm;

import SRC/with-only-class.lm;

Expand Down
2 changes: 1 addition & 1 deletion SRC/infer-expr.lm
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ infer-expr-one := λ(: tctx TContext)(: term AST)(: scoped IsScoped)(: hint Type
( (TGround( 'Array_s (LCons( _ (LCons( TAny LEOF )) )) )) () )
( (TGround( 'Array_s (LCons( TAny (LCons( array-base LEOF )) )) )) (
(maybe-specialize( 'open_s (typeof-var-raw( term tctx 'open_s )) deref-type ))
(set deref-type (&&( array-base (t1 'StackVariable_s) )))
(set deref-type array-base)
))
( _ (do-specialize( 'open_s (typeof-var-raw( term tctx 'open_s )) deref-type term )) )
))
Expand Down
2 changes: 1 addition & 1 deletion SRC/infer-global-context.lm
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ infer-global-context-2 := λ(: td AST). (: (
( (Glb( k_t rhs )) (
(infer-expr( global-type-context rhs Unscoped TAny Used ))
(let rhst (normalize(typeof rhs)))
(let kt (&&( (without-representation rhst) (t1 'GlobalVariable_s) )))
(let kt (&&( rhst (t1 'GlobalVariable_s) )))
(set global-type-context (TCtxBind(
(close global-type-context) k kt td
)))
Expand Down
2 changes: 2 additions & 0 deletions SRC/infer-type-definition.lm
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,7 @@ infer-type-definition := λ(: base-type Type)(: body AST)(: case-number U64). (:
(t2( 'CaseNumber_s (t1 '0_s) ))
))
) ())
(add-quick-prop( (t3( 'Array_s base-type TAny )) TAny (t1 'LMStruct_s) ))
(add-quick-prop( base-type TAny (t1 'LMStruct_s) ))
r
) U64);
2 changes: 0 additions & 2 deletions SRC/normalize.lm
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@

normalize := λ(: tt Type). (: (
(let rt tt)
(set rt (without-representation rt))
(set rt (without-platform-props rt))
(set rt (.without-tag rt))
# Sized can serve as a datatype if nothing else is available
(set rt (without-size-unless-class rt))
Expand Down
35 changes: 0 additions & 35 deletions SRC/with-platform-props.lm

This file was deleted.

31 changes: 0 additions & 31 deletions SRC/without-platform-props.lm

This file was deleted.

52 changes: 0 additions & 52 deletions SRC/without-representation.lm

This file was deleted.

9 changes: 8 additions & 1 deletion SRC/without-tag.lsts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ let .without-tag(tt: Type): Type = (
TGround { tag:c"Constructor" } => TAny;
TGround { tag:c"CaseNumber" } => TAny;
TGround { tag:c"Raw" } => TAny;
TGround { tag:tag } => if tag.has-prefix(c"Tag::") then TAny else tt;
TGround { tag:c"LMStruct" } => TAny;
TGround { tag:c"Constant" } => TAny;
TGround { tag:c"Literal" } => TAny;
TGround { tag:c"LocalVariable" } => TAny;
TGround { tag:c"GlobalVariable" } => TAny;
TGround { tag:tag } => if tag.has-prefix(c"Tag::") then TAny
else if tag.has-prefix(c"Field::") then TAny
else tt;
_ => tt;
}
);
Expand Down

0 comments on commit fd24671

Please sign in to comment.