Repository navigation
Refactor nested GrammarExpr sequences to FormalProduction flat-list rhs across extdeps Wave-1/2a language files (prereqs met: #3796 + #3805 on main) #3837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,8 +6,13 @@ | |
| module v4.extdeps.languages.kotlin | ||
|
|
||
| import v4.std.grammar { | ||
| ParseGrammar, | ||
| Choice, | ||
| FormalGrammarSymbol, | ||
| FormalNonterminal, | ||
| FormalProduction, | ||
| FormalTerminal, | ||
| FormalTerminalOccurrence, | ||
| ParseGrammar, | ||
| GrammarExpr, | ||
| GrammarProduction, | ||
| GrammarRoot, | ||
|
|
@@ -17,9 +22,9 @@ import v4.std.grammar { | |
| Repeat, | ||
| Sequence, | ||
| Terminal, | ||
| formal_production_to_node, | ||
| grammar_carries_symbol, | ||
| grammar_empty_sync_tokens, | ||
| grammar_production_to_node | ||
| grammar_empty_sync_tokens | ||
| } | ||
| import v4.std.lexing { | ||
| CharClassPattern, | ||
|
|
@@ -1125,6 +1130,28 @@ fn kotlin_grammar_sequence_from_nonempty( | |
| ) | ||
| } | ||
|
|
||
| fn kotlin_formal_production_from_nonempty( | ||
| head: KotlinConcreteSyntaxToken, | ||
| tail: List<KotlinConcreteSyntaxToken> | ||
| ) -> FormalProduction { | ||
| let tokens = kotlin_concrete_tokens_list(head: head, tail: tail) | ||
| FormalProduction { | ||
| lhs: FormalNonterminal { identity: kotlin_production_mvp1_fn_add }, | ||
| rhs: fold_list( | ||
| xs: tokens, | ||
| empty: Empty, | ||
| cons: fn(acc, token) { | ||
| list_snoc_item( | ||
| xs: acc, | ||
| item: FormalTerminalOccurrence { | ||
| terminal: FormalTerminal { identity: kotlin_concrete_token_class(token: token) } | ||
| } | ||
| ) | ||
| } | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| fn kotlin_grammar_production_from_nonempty( | ||
| head: KotlinConcreteSyntaxToken, | ||
| tail: List<KotlinConcreteSyntaxToken> | ||
|
|
@@ -1308,18 +1335,18 @@ fn kotlin_relation_token_edges(tokens: List<KotlinConcreteSyntaxToken>) -> List< | |
| } | ||
|
|
||
| fn kotlin_grammar_relation_row_node(row: KotlinGrammarRelationRow) -> Node { | ||
| let production = kotlin_grammar_production_from_nonempty(head: row.head, tail: row.tail) | ||
| let production = kotlin_formal_production_from_nonempty(head: row.head, tail: row.tail) | ||
| let tokens = kotlin_concrete_tokens_list(head: row.head, tail: row.tail) | ||
| Node { | ||
| kind: TypeNode { connective: Conj }, | ||
| children: [ | ||
| kotlin_named_edge( | ||
| name: grammar_relation_field_production, | ||
| target: grammar_production_to_node(production: production) | ||
| target: formal_production_to_node(production: production) | ||
| ), | ||
| kotlin_named_edge( | ||
| name: grammar_relation_field_emitted, | ||
| target: production.emitted | ||
| target: kotlin_mvp1_emitted_add_fn_node() | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BLOCKING: The relation-row projection hardcodes kotlin_mvp1_emitted_add_fn_node after switching to FormalProduction, leaving emitted output outside the row’s typed authority and violating INVARIANTS.md P2 single-authority/facts-flow-forward. |
||
| ), | ||
| kotlin_named_edge( | ||
| name: grammar_relation_field_tokens, | ||
|
|
||
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BLOCKING: The relation-row projection now fabricates the MVP1 emitted node instead of reading an emitted fact from the row, so replacing GrammarProduction with FormalProduction silently drops emission authority and violates INVARIANTS.md P2 facts-flow-forward.