Skip to content

Commit

Permalink
Merge pull request #1209 from andrew-johnson-4/lm-to-lsts-faemwlq
Browse files Browse the repository at this point in the history
Lm to lsts faemwlq
  • Loading branch information
andrew-johnson-4 authored Feb 1, 2025
2 parents 809ea25 + baea3c6 commit dc2396a
Show file tree
Hide file tree
Showing 12 changed files with 21,634 additions and 21,750 deletions.
43,240 changes: 21,592 additions & 21,648 deletions BOOTSTRAP/cli.c

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions SRC/cli.lm

This file was deleted.

1 change: 0 additions & 1 deletion SRC/index-index.lm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import SRC/unit-preprocess.lsts;

import SRC/index-definitions.lm;
import SRC/index-globals.lm;
import SRC/index-utility.lm;
import SRC/index-tokenize.lm;
import SRC/index-types.lm;
import SRC/index-context.lm;
Expand Down
1 change: 0 additions & 1 deletion SRC/index-tokenize.lm
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

import SRC/with-location.lm;
import SRC/without-location.lm;
import SRC/with-key.lm;
import SRC/to-smart-string.lsts;
import SRC/formatted-location.lsts;
1 change: 0 additions & 1 deletion SRC/index-types.lm
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import SRC/apply-plural.lm;
import SRC/apply-or-cons-and-specialize.lm;
import SRC/try-specialize.lm;

import SRC/unify-hint.lm;
import SRC/infer-type-definition.lm;
import SRC/typeof-var.lm;
import SRC/typeof-var-raw.lm;
Expand Down
2 changes: 0 additions & 2 deletions SRC/index-utility.lm

This file was deleted.

36 changes: 0 additions & 36 deletions SRC/unify-hint.lm

This file was deleted.

21 changes: 21 additions & 0 deletions SRC/unify-hint.lsts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

let unify-hint(hint: Type, tt: Type): Type = (
match Tuple{hint, tt} {
Tuple{first:TGround{hint-tag=tag, hint-args=parameters},
second:TGround{tt-tag=tag, tt-args=parameters}} => (
if hint-tag == tt-tag { hint }
else { TGround{ tt-tag, close(unify-hint(hint,tt-args)) } };
);
Tuple{second:TAnd{lt=left,rt=right}} => (
TAnd{ close(unify-hint(hint,lt)), close(unify-hint(hint,rt)) };
);
_ => tt;
}
);

let unify-hint(hint: Type, tt: List<Type>): List<Type> = (
match tt {
LCons{ th=head, tl=tail } => cons( unify-hint(hint,th), unify-hint(hint,tl) );
_ => tt;
}
);
1 change: 1 addition & 0 deletions SRC/unit-ast.lsts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ import SRC/uuid.lsts;
import SRC/smart-token-location.lsts;
import SRC/plus.lsts;
import SRC/unique.lsts;
import SRC/without-location.lsts;
1 change: 1 addition & 0 deletions SRC/unit-inference.lsts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import SRC/tctx-union.lsts;
import SRC/tctx-and.lsts;
import SRC/tctx-bind.lsts;
import SRC/reduce-plural.lsts;
import SRC/unify-hint.lsts;

# corollaries
import SRC/quick-prop.lsts;
Expand Down
59 changes: 0 additions & 59 deletions SRC/without-location.lm

This file was deleted.

19 changes: 19 additions & 0 deletions SRC/without-location.lsts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

# without-location is mainly used to scrub macro location information so that the preprocessor knows to overwrite them

let without-location(term: AST): AST = (
match term {
Var{key=key,token=token} => Var{key,without-location(token)};
Lit{key=key,token=token} => Lit{key,without-location(token)};
App{left=left,right=right} => App{close(without-location(left)),close(without-location(right))};
Seq{left=left,right=right} => Seq{close(without-location(left)),close(without-location(right))};
Abs{lhs=lhs,rhs=rhs,tt=tt} => Abs{close(without-location(lhs)),close(without-location(rhs)),tt};
Typedef{lhs=lhs,rhs=rhs} => Typedef{close(without-location(lhs)),close(without-location(rhs))};
Glb{key=key,val=val} => Glb{key,close(without-location(val))};
_ => term;
}
);

let without-location(t: Token): Token = (
Token{ t.key, t.nonce, mk-location() }
);

0 comments on commit dc2396a

Please sign in to comment.