Skip to content

Commit 71d7bf3

Browse files
committed
successful deploy now to remove debug print
1 parent 90a4842 commit 71d7bf3

6 files changed

Lines changed: 3419 additions & 3755 deletions

File tree

BOOTSTRAP/cli.c

Lines changed: 3413 additions & 3545 deletions
Large diffs are not rendered by default.

PLUGINS/BACKEND/C/cc-blob.lsts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

22
let cc-blob(callee-ctx: FContext, function-name: CString, args-tt: Type, blame: AST): Fragment = (
3+
print("Blob \{function-name}(\{args-tt})\n");
34
let f = Some(mk-tctx()).find-callable(function-name, args-tt, blame).blame-or-zero;
45
if typeof-term(f).is-open then exit-error("STD C cc-blob is open \{function-name} (\{args-tt})\n", blame);
56
match f {

PLUGINS/BACKEND/C/std-c-compile-call.lsts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ let std-c-compile-call(ctx: FContext, fname: CString, args: AST): Fragment = std
44
let std-c-compile-call(ctx: FContext, fname: CString, return-hint-if-constructor: Type, args: AST): Fragment = (
55
let fterm = Some(mk-tctx()).maybe-find-callable(fname, typeof-term(args), args, return-hint-if-constructor)
66
.expect("std-c-compile-call Function \{fname} was null\nArguments: \{typeof-term(args)}, Return Hint \{return-hint-if-constructor}\nAt \{args.location}\n").blame-or-zero;
7-
let return = if typeof-term(fterm).is-t(c"Blob",0) {
7+
if typeof-term(fterm).is-t(c"Blob",0) {
88
if typeof-term(fterm).is-open and fname!=c"open" and fname!=c"mov" then {
99
for tr in Some(mk-tctx()).lookups(fname) {
1010
print("STD C compile call candidate \{fname} : \{tr.dt-or-zero}\n");
@@ -43,9 +43,6 @@ let std-c-compile-call(ctx: FContext, fname: CString, return-hint-if-constructor
4343
_ => fail("Unexpected fterm in std-c-compile-call: \{fname}\n\{fterm}\n");
4444
}; r
4545
};
46-
let fe = return.get(c"expression");
47-
print("Comile call \{fname}(\{args}) = \{clone-rope(fe)}\n");
48-
return
4946
);
5047

5148

PLUGINS/BACKEND/C/std-c-compile-expr.lsts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ let .rewrite-if-reserved(s: CString): CString = (
6666
);
6767

6868
let std-c-compile-expr(ctx: FContext, t: AST, is-stmt: Bool): Fragment = (
69-
print("Compile \{t}\n");
7069
let f = match t {
7170
Var{ key=key } => (
7271
if typeof-term(t) <: type-c-void {

PLUGINS/FRONTEND/LSTS/lsts-parse.lsts

Lines changed: 3 additions & 201 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,125 +1292,6 @@ let lsts-parse-small-expression(tokens: List<Token>): Tuple<AST,List<Token>> = (
12921292
Tuple ( base, tokens )
12931293
);
12941294

1295-
let lsts-parse-match2-lhs-one(tokens: List<Token>): Tuple<AST,List<Token>> = (
1296-
let expr = mk-eof();
1297-
if lsts-parse-head(tokens)==c"[" {
1298-
let loc = head(tokens).location;
1299-
lsts-parse-expect(c"[", tokens); tokens = tail(tokens);
1300-
expr = mk-app(mk-var(c"macro::lhs-tail").with-location(loc), mk-nil());
1301-
let seq = [] : List<AST>;
1302-
while non-zero(tokens) and lsts-parse-head(tokens)!=c"]" {
1303-
(let head, tokens) = lsts-parse-match2-lhs-one-bind(tokens);
1304-
if lsts-parse-head(tokens)==c"." and lsts-parse-head(tail(tokens))==c"." {
1305-
lsts-parse-expect(c".", tokens); tokens = tail(tokens);
1306-
lsts-parse-expect(c".", tokens); tokens = tail(tokens);
1307-
seq = cons(head, seq);
1308-
} else {
1309-
lsts-parse-expect(c"]", tokens);
1310-
expr = head;
1311-
}
1312-
};
1313-
for s in seq {
1314-
expr = mk-app( mk-var(c"macro::lhs-head"), mk-cons(s,expr) );
1315-
};
1316-
lsts-parse-expect(c"]", tokens); tokens = tail(tokens);
1317-
} else if lsts-parse-head(tokens)==c"(" {
1318-
lsts-parse-expect(c"(", tokens); tokens = tail(tokens);
1319-
(expr, tokens) = lsts-parse-match2-lhs-one-bind(tokens);
1320-
lsts-parse-expect(c")", tokens); tokens = tail(tokens);
1321-
} else if lsts-parse-head(tokens)==c"uuid" {
1322-
let loc = head(tokens).location;
1323-
lsts-parse-expect(c"uuid", tokens); tokens = tail(tokens);
1324-
lsts-parse-expect(c"(", tokens); tokens = tail(tokens);
1325-
(let name, tokens) = lsts-parse-identifier(tokens);
1326-
lsts-parse-expect(c")", tokens); tokens = tail(tokens);
1327-
expr = mk-app( mk-var(c"uuid").with-location(loc), mk-var(name).with-location(loc) );
1328-
} else if lsts-parse-head(tokens).is-lsts-constant {
1329-
expr = lsts-make-lit(head(tokens)); tokens = tail(tokens);
1330-
} else if lsts-is-enum-head(lsts-parse-head(tokens)) or (lsts-parse-head(tokens)==c"_" and lsts-parse-head(tail(tokens))==c"{") {
1331-
let loc = head(tokens).location;
1332-
let tag = lsts-parse-head(tokens); tokens = tail(tokens);
1333-
let suffix-condition = mk-var(c"_").with-location(loc);
1334-
if lsts-parse-head(tokens)==c"{" {
1335-
lsts-parse-expect(c"{", tokens); tokens = tail(tokens);
1336-
while non-zero(tokens) and lsts-parse-head(tokens)!=c"}" {
1337-
let mode = c"macro::let-name";
1338-
if lsts-parse-head(tokens)==c"set" { mode = c"macro::set-name"; tokens = tail(tokens) }
1339-
else if lsts-parse-head(tokens)==c"let" { mode = c"macro::let-name"; tokens = tail(tokens) };
1340-
let raw = false;
1341-
if lsts-parse-head(tokens)==c"raw" { raw = true; tokens = tail(tokens) };
1342-
let bind-name = c"_";
1343-
(let field-name, tokens) = lsts-parse-identifier(tokens);
1344-
if lsts-parse-head(tokens)==c"=" {
1345-
lsts-parse-expect(c"=", tokens); tokens = tail(tokens);
1346-
bind-name = field-name;
1347-
(field-name, tokens) = lsts-parse-identifier(tokens);
1348-
};
1349-
let val = if lsts-parse-head(tokens)==c":" {
1350-
lsts-parse-expect(c":", tokens); tokens = tail(tokens);
1351-
(let val, tokens) = lsts-parse-match2-lhs-one(tokens);
1352-
val
1353-
} else {
1354-
mk-var(c"_").with-location(loc)
1355-
};
1356-
let bind = if bind-name==c"_" then mk-var(bind-name).with-location(loc)
1357-
else mk-app( mk-var(mode), mk-var(bind-name).with-location(loc) );
1358-
let new-cond = if raw {
1359-
mk-app( mk-var(c"macro::lhs-raw-struct-field"), mk-cons(
1360-
mk-cons(
1361-
bind,
1362-
mk-var(field-name)
1363-
),
1364-
val
1365-
));
1366-
} else {
1367-
mk-app( mk-var(c"macro::lhs-struct-field"), mk-cons(
1368-
mk-cons(
1369-
bind,
1370-
mk-var(field-name)
1371-
),
1372-
val
1373-
));
1374-
};
1375-
suffix-condition = mk-app( mk-var(c"macro::lhs-struct"), mk-cons(new-cond, suffix-condition) );
1376-
if lsts-parse-head(tokens)!=c"}" {
1377-
lsts-parse-expect(c",", tokens); tokens = tail(tokens);
1378-
};
1379-
};
1380-
lsts-parse-expect(c"}", tokens); tokens = tail(tokens);
1381-
};
1382-
if tag == c"_" {
1383-
expr = suffix-condition;
1384-
} else {
1385-
expr = mk-app(mk-var(c"macro::lhs-struct"), mk-cons( mk-lit(tag).with-location(loc), suffix-condition ));
1386-
};
1387-
} else if lsts-parse-head(tokens)==c"_" {
1388-
expr = mk-var(c"_").with-location(head(tokens).location);
1389-
lsts-parse-expect(c"_", tokens); tokens = tail(tokens);
1390-
} else if lsts-is-ident-head(lsts-parse-head(tokens)) {
1391-
(let name2, tokens) = lsts-parse-identifier(tokens);
1392-
expr = mk-var(name2).with-location(head(tokens).location);
1393-
} else {
1394-
lsts-parse-expect(c"[Left Hand Side]", tokens);
1395-
};
1396-
(expr, tokens)
1397-
);
1398-
1399-
let lsts-parse-match2-lhs-one-bind(tokens: List<Token>): Tuple<AST,List<Token>> = (
1400-
if lsts-has-assign(tokens) {
1401-
let mode = c"macro::let-bind";
1402-
if lsts-parse-head(tokens)==c"set" { mode = c"macro::set-bind"; tokens = tail(tokens) }
1403-
else if lsts-parse-head(tokens)==c"let" { mode = c"macro::let-bind"; tokens = tail(tokens) };
1404-
(let name, tokens) = lsts-parse-identifier(tokens);
1405-
lsts-parse-expect(c"=", tokens); tokens = tail(tokens);
1406-
(let rest, tokens) = lsts-parse-match2-lhs-one(tokens);
1407-
let expr = mk-app(mk-var(mode), mk-cons(rest, mk-var(name)));
1408-
(expr, tokens)
1409-
} else {
1410-
lsts-parse-match2-lhs-one(tokens);
1411-
}
1412-
);
1413-
14141295
let .is-assign-lit(t: AST): Bool = (
14151296
match t {
14161297
App{ left:Var{key:c"macro::let-bind"} } => true;
@@ -1442,86 +1323,6 @@ let .is-constant(t: AST): Bool = (
14421323
}
14431324
);
14441325

1445-
let lsts-parse-match2-lhs(tokens: List<Token>): Tuple<AST,List<Token>> = (
1446-
# prefixes
1447-
# suffixes
1448-
# list-likes
1449-
# tuples
1450-
# objects
1451-
let original-tokens = tokens;
1452-
(let lhs, tokens) = lsts-parse-match2-lhs-one-bind(tokens);
1453-
let presufs = mk-vector(type(AST)).push(lhs);
1454-
while lsts-parse-head(tokens)==c"." and lsts-parse-head(tail(tokens))==c"." {
1455-
lsts-parse-expect(c".", tokens); tokens = tail(tokens);
1456-
lsts-parse-expect(c".", tokens); tokens = tail(tokens);
1457-
(lhs, tokens) = lsts-parse-match2-lhs-one-bind(tokens);
1458-
presufs = presufs.push(lhs);
1459-
};
1460-
let prefixes = mk-vector(type(AST));
1461-
let suffixes = mk-vector(type(AST));
1462-
let starti = 0_sz;
1463-
let endi = presufs.length - 1;
1464-
while starti < endi and presufs[starti].is-constant or presufs[starti].is-assign-lit {
1465-
prefixes = prefixes.push(presufs[starti]);
1466-
starti = starti + 1;
1467-
};
1468-
while starti < endi and presufs[endi].is-constant or presufs[endi].is-assign-lit {
1469-
suffixes = suffixes.push(presufs[endi]);
1470-
endi = endi - 1;
1471-
};
1472-
if endi != starti then {
1473-
fail("Invalid Prefix/Suffix Chain", original-tokens.formatted-location);
1474-
};
1475-
lhs = presufs[starti];
1476-
for p in prefixes {
1477-
lhs = mk-app(mk-var(c"macro::lhs-prefix"), mk-cons(p, lhs));
1478-
};
1479-
while suffixes.length > 0 {
1480-
(let p, suffixes) = suffixes.pop-backwards-compatible();
1481-
lhs = mk-app(mk-var(c"macro::lhs-suffix"), mk-cons(p, lhs));
1482-
};
1483-
if lsts-parse-head(tokens)==c"where" {
1484-
lsts-parse-expect(c"where", tokens); tokens = tail(tokens);
1485-
(let cond, tokens) = lsts-parse-ascript(tokens);
1486-
lhs = mk-app( mk-var(c"macro::lhs-guard"), mk-cons(lhs,cond) );
1487-
};
1488-
(lhs, tokens)
1489-
);
1490-
1491-
let lsts-parse-match2(tokens: List<Token>): Tuple<AST,List<Token>> = (
1492-
let loc = head(tokens).location;
1493-
lsts-parse-expect(c"match2", tokens); tokens = tail(tokens);
1494-
let raw = lsts-parse-head(tokens)==c"raw"; if raw { tokens = tail(tokens); };
1495-
(let expr, tokens) = lsts-parse-small-expression(tokens);
1496-
if raw then expr = mk-app(mk-var(c"macro::bind-raw"), expr);
1497-
let case-root = mk-app(mk-var(c"fail"),mk-cons(
1498-
mk-lit(c"Pattern Match Failure").ascript(t0(c"String") && t0(c"Literal")),
1499-
mk-app(mk-var(c"macro::location"),mk-var(c"here").with-location(loc))
1500-
));
1501-
lsts-parse-expect(c"{", tokens); tokens = tail(tokens);
1502-
let cases = [] : List<(AST,AST)>;
1503-
while non-zero(tokens) and lsts-parse-head(tokens)!=c"}" {
1504-
(let lhs, tokens) = lsts-parse-match2-lhs(tokens);
1505-
lsts-parse-expect(c"=", tokens); tokens = tail(tokens);
1506-
lsts-parse-expect(c">", tokens); tokens = tail(tokens);
1507-
if lsts-parse-head(tokens) == c"{" {
1508-
fail("Please wrap map literals in match cases in parenthesis. At \{tokens.formatted-location}\n");
1509-
};
1510-
(let rhs, tokens) = lsts-parse-small-expression(tokens);
1511-
lsts-parse-expect(c";", tokens); tokens = tail(tokens);
1512-
cases = cons( (lhs,rhs), cases );
1513-
};
1514-
for Tuple{lhs=first,rhs=second} in cases {
1515-
case-root = mk-app(
1516-
mk-var(c"macro::match-case"),
1517-
mk-cons(mk-cons(lhs,rhs),case-root)
1518-
);
1519-
};
1520-
lsts-parse-expect(c"}", tokens); tokens = tail(tokens);
1521-
let result-expr = mk-app(mk-var(c"macro::match"), mk-cons(expr, case-root));
1522-
(result-expr, tokens);
1523-
);
1524-
15251326
let lsts-parse-assign(tokens: List<Token>): Tuple<AST,List<Token>> = (
15261327
let base = mk-eof();
15271328
if lsts-has-assign(tokens) {
@@ -1898,8 +1699,6 @@ let lsts-parse-atom-without-tail(tokens: List<Token>): Tuple<AST,List<Token>> =
18981699
)
18991700
)
19001701
);
1901-
} else if lsts-parse-head(tokens)==c"match2" {
1902-
(term, tokens) = lsts-parse-match2(tokens);
19031702
} else if lsts-parse-head(tokens)==c"match" {
19041703
let loc = head(tokens).location; tokens = tail(tokens);
19051704
let raw = if lsts-parse-head(tokens)==c"raw" {
@@ -1941,6 +1740,9 @@ let lsts-parse-atom-without-tail(tokens: List<Token>): Tuple<AST,List<Token>> =
19411740
);
19421741
} else if lsts-parse-head(tokens).has-suffix(c"_ss") {
19431742
(term, tokens) = lsts-parse-lit(tokens);
1743+
} else if lsts-parse-head(tokens).has-suffix(c"_l") {
1744+
term = mk-lit(lsts-parse-head(tokens).remove-suffix(c"_l").get-or-panic).ascript(t0(c"L"));
1745+
tokens = tail(tokens);
19441746
} else if lsts-parse-head(tokens).has-suffix(c"_rl") {
19451747
term = mk-lit(lsts-parse-head(tokens).remove-suffix(c"_rl").get-or(c""));
19461748
tokens = tail(tokens);

SRC/typecheck-infer-expr.lsts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ let std-infer-expr(tctx: Maybe<TypeContext>, term: AST, is-scoped: Bool, used: I
1111
);
1212

1313
let std-infer-expr(tctx: Maybe<TypeContext>, term: AST, is-scoped: Bool, used: IsUsed, hint: Type, rewritten-constant: Bool): (TypeContext?, AST) = (
14-
print("Term \{term}\n");
1514
profile-visit-ast-unique(term);
1615
profile-visit-ast-equal(term);
1716
if not(term.is-free-and-seen) { match term {
@@ -89,10 +88,9 @@ let std-infer-expr(tctx: Maybe<TypeContext>, term: AST, is-scoped: Bool, used: I
8988
tt = tt.rewrite-type-alias;
9089
add-concrete-type-instance(tt, term);
9190
(tctx, let new-t) = std-infer-expr(tctx, t, false, Tail, tt, not hint <: type-tail-position);
92-
print("Rewritten \{new-t}\n");
9391
if not(is(t,new-t)) then { t = new-t; term = mk-app(asc, mk-app(t, mk-atype(tt))); };
9492
let is-nullary = false;
95-
if typeof-term(t).is-arrow and not(tt.is-arrow) and non-zero(var-name-if-var-or-lit(t)) {
93+
if typeof-term(t).is-arrow and not(tt.is-arrow) and non-zero(var-name-if-var-or-lit(t)) and not(tt.is-t(c"L",0)) {
9694
# This case exists for nullary constructors like TAny : Type
9795
let ftype = tctx.find-callable( var-name-if-var-or-lit(t), type-nil, term, tt ).direct-type;
9896
tctx = tctx.ascript(term, ftype);
@@ -108,7 +106,6 @@ let std-infer-expr(tctx: Maybe<TypeContext>, term: AST, is-scoped: Bool, used: I
108106
# frontend is producing ((None : TContext?)()) instead of (None() : TContext?)
109107
# the return hint stuff is working, so all the hard work is done. I think only the frontend needs to change
110108
tt = tt.without-slot(c"ReturnHint",0).rewrite-type-alias;
111-
print("Ascripted \{t}\n");
112109
if not(can-unify(tt, typeof-term(term)))
113110
then exit-error("Ascripted value does not match declared type:\nExpected \{tt}\nFound \{typeof-term(t)}\n", term);
114111
};

0 commit comments

Comments
 (0)