Skip to content

s2: type decls and value args on types - #18

Merged
vic merged 1 commit into
mainfrom
s2-typedecl
Nov 9, 2026
Merged

vic merged 1 commit into
mainfrom
s2-typedecl

Conversation

@vic

@vic vic commented Nov 9, 2026

Copy link
Copy Markdown
Owner

FRONT rung 4b: type declarations and compile-time value args on types.

  • Ast.Ty gains vals for T(v, ...), in s1's order: name, [args], (vals), ^<caps>.
  • Ast.TypeDecl has body Alias | TyMatch | ValMatch; value patterns are int, string, true, false, or _.
  • Printer and parser follow s1/parse.srs:297-346.
  • Names declares the type name and walks its body; the value binders are locals of the value args.

Test: value matches on an int and a Bool, a value arg with an expression, a type match, a type with evidence and facts groups, and a param type with value args and caps all print back as written. A type lambda is a parse error, as in s1.

Parse probe: 170 of 176 sources. The other 6: four s1 parse errors (s2 rejects them too), contracts.srs (clauses, next rung), and one int type arg (s1 rejects it later). Local tests/run.sh: 185 ok, 0 FAIL.

Ast.Ty gains vals, the value args T(v, ...) (s1 order: name, [args], (vals), ^<caps>). Ast.TypeDecl
(line, name, groups, value binders, body) with Ast.TBody = Alias(ty) | TyMatch(ty, arms) |
ValMatch(binder, arms); value patterns are int, string, true, false or _ (Ast.VPat). The printer and the
parser follow s1/parse.srs:297-346: a value binder followed by match is a value match, else a type
optionally followed by match arms. Names declares a type decl as a type name and walks its types in its
[] binders, with its value binders as locals of the value args (Names.tyIn). Printer functions that
print types take a Region (value args are expressions).

tests/s2/parse: value matches on an int and a Bool, a value arg with an expression, a type match, a type
with evidence and facts groups, a param type with value args and caps print back as written; a type
lambda is a parse error, as in s1. Parsing every source: 170 of 176; the rest are 4 s1 parse errors
(s2 rejects them too), contracts.srs (clauses: next rung) and one int type arg (s1 rejects later).
@vic
vic merged commit e4155ab into main Nov 9, 2026
3 checks passed
@vic
vic deleted the s2-typedecl branch November 9, 2026 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant