Conversation
|
@keyboardDrummer Changed the default format instance for Core programs, as requested. |
Co-authored-by: Joe Hendrix <joehx@amazon.com>
Co-authored-by: Joe Hendrix <joehx@amazon.com>
Co-authored-by: Joe Hendrix <joehx@amazon.com>
|
Grammar.lean:194 — Spurious parens on assignment LHS (e.g., Suggested fix: op assign (tp : Type, v : Lhs, e : tp) : Statement => v:0 " := " e ";\n"; |
In that case, isn't this PR creating duplication (and thus extra maintenance) for Imperative and Lambda, since for those it needs to define both the I'll be straightforward: I don't think the DDM is an idiomatic solution to the problem of defining grammars. I think it will always suffer from requiring back and forth Besides the If the |
I'd like to do that in a separate PR, once this translation has had some miles on it. Also, I suspect we may want to retain some format instances for debugging (e.g., for viewing metadata), but I haven't thought this through entirely yet. |
I have a separate PR coming to print Lambda expressions using the DDM. That'd render the VCs in Core's DDM syntax too. |

Description of changes:
Translation from Core's AST to DDM's CST (generated using
#strata_gen) for pretty-printing Core constructs.New Files
Translator:
Strata/Languages/Core/DDMTransform/ASTtoCST.leanTests:
StrataTest/Languages/Core/TestASTtoCST.leanNOTE: DDM's type variable printing using
mformathas been changed fromtvar!<n>to just<n>.Revamping the existing translator in
Strata/Languages/Core/DDMTransform/Translate.leanto use DDM's#strata_gen'd AST is out of scope for this PR.Known issues
Constructs unsupported in this PR (coming soon):
-- Sub-functions (functions defined inside procedures)
We generate some bound variables' names during translation because the semantic AST currently does not preserve them (e.g., bvars in quantifiers). We can log the identifier names during CST -> AST translation in the latter's metadata field and recover them in the future.
Misc. formatting issues
-- Remove extra parentheses around constructors in datatypes, assignments, etc.
-- Remove extra indentation from the last brace of a block and the
endkeyword of a mutual block.(NOTE: a large bulk of this PR was created using Claude)
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.