Repository navigation
Conversation
…ors as data
Parse.source lexes, then parses the tokens as s1/parse.srs: def and extern def with binder groups
[] {} <> before and after the params and exit facts after the result type; enum with cases; protocol
with states, start, end, drop, ops (A -> B transitions) and rule defs; handler; types T[args]^<caps>;
expressions by precedence (s1 opLevel, left associative), unary - and !, calls f[T]{a}(x), methods,
if (a NL before else allowed), while, assignment, postfix match with flat patterns; blocks by layout
(the value is the last expression statement); val, var, handle; val C(a, b) = e becomes a one-arm match
over the rest of the block; a char literal is its int value. Each production returns Parse.Ok(value,
rest) or Parse.Err(line, expected). Not yet: trait, given, type, spec def, clauses, forall.
tests/s2/parse: tests/s2/ast.out (the printer's text of hand-built Asts) parses and prints back, with
one known blank-line difference (ast.srs prints two decls in two calls); val C(a, b), a left
associative chain, an else on its own line; three parse errors. Mutants: * at the level of +, right
associative operators, no NL before else, no val C(a, b), [] groups as {}: each changes the output.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FRONT rung 2: the parser (
s2/parse.srs, moduleParse), recursive descent into the s2 Ast as s1/parse.srs does it. Every production returnsParse.Ok(value, rest)orParse.Err(line, expected).Covered:
[] {} <>groups and exit facts;T[args]^<caps>; expressions by s1 precedence (left associative), unary, callsf[T]{a}(x), methods;val C(a, b) = ebecomes a one-arm match; char literal as an int.Not yet: trait, given, type decls, spec def, clauses, forall/exists.
Oracle: tests/s2/ast.out (the printer's text of hand-built Asts) parses and prints back. There is one known blank-line difference, because tests/s2/ast.srs:120-121 prints two decls in two calls. Extra cases cover
val C(a,b), a left-associative chain, an else line, and three parse errors. Five mutants each change the output. Local tests/run.sh: 185 ok, 0 FAIL.