-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
[WIP] Improved codegen #34
Merged
brightly-salty
merged 2 commits into
mlatu-lang:rust
from
ThePuzzlemaker:improved-codegen
Oct 5, 2021
Merged
[WIP] Improved codegen #34
brightly-salty
merged 2 commits into
mlatu-lang:rust
from
ThePuzzlemaker:improved-codegen
Oct 5, 2021
Conversation
This file contains 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 was referenced Oct 4, 2021
brightly-salty
added a commit
that referenced
this pull request
Oct 5, 2021
* AST/parser changes, remove anyhow Patched out editor for now just because it'd be too borked Co-authored-by: Caden Haustein <code@brightlysalty.33mail.com> * Use unic-ucd-category intead of unic-ucd Co-authored-by: Caden Haustein <code@brightlysalty.33mail.com>
SWIPL provides a FFI interface called the FLI that can make code generation more ergonomic and less fallible. This PR uses that interface. There are some rough edges in the library I used (cc terminusdb-labs/swipl-rs#4), but it's still a lot better than generating text and parsing SWIPL's output as text (which would probably not work if an exception is raised). There is still a bit more that needs to be done in terms of ergonomics and error handling, but this prototype is at a pretty good state at the moment. This commit is a squash of the following commits: - [WIP] Improved codegen - Revamp prelude/builtins, move save state to target/ - Remove unnecessary primitive, unnecessary dependencies, and fix clippy warnings - Undo some parser/deps changes - Revert the previous - Remove merge artifact - Fix code for new AST Co-authored-by: Caden Haustein <code@brightlysalty.33mail.com>
ThePuzzlemaker
force-pushed
the
improved-codegen
branch
from
October 5, 2021 00:26
d739d38
to
f0ac83f
Compare
brightly-salty
approved these changes
Oct 5, 2021
brightly-salty
added a commit
that referenced
this pull request
Oct 7, 2021
* Initial Rust work * Fix clippy hints, better error handling * Build time + runtime improvements * Add structured editor * Fix prelude and allow newlines/CR (#31) * AST/Parser changes (From #34 , separated into this PR) (#36) * AST/parser changes, remove anyhow Patched out editor for now just because it'd be too borked Co-authored-by: Caden Haustein <code@brightlysalty.33mail.com> * Use unic-ucd-category intead of unic-ucd Co-authored-by: Caden Haustein <code@brightlysalty.33mail.com> * [WIP] Improved codegen (#34) * UI improvements for structural editor (#32) * Use std::fmt for centering, add labels for halves This makes everything cleaner! With some algebra and code™, it's possible to use `format!` for centering text. This commit also adds labels to the pattern and replacement half, just being centered boxes `| Pattern |` and `| Replacement |` in the usually bland `--------`(...) line after the status. * Fix rule index (off-by-one errors go brrr) * Switch from termion to crossterm Squash of: - Switch from termion to crossterm (@brightly-salty) - Abstract away a view for easier layouting (@brightly-salty) - Add lockfile (@ThePuzzlemaker) - Undo some AST/parser changes (@ThePuzzlemaker) Co-authored-by: ThePuzzlemaker <tpzker@thepuzzlemaker.info> * Fix code for new AST, make pretty_rule use &[Term] instead of Vec<Term> * Rebase and fix * Add failing interactive mode * Improve interactive rewriter * Fix prelude + mlatu.pl * Add CLI + standardize keybindings Co-authored-by: Caden Haustein <code@brightlysalty.33mail.com> * Update documentation Co-authored-by: James [Undefined] <tpzker@thepuzzlemaker.info>
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.
Motivation
Generating text is fallible, and probably inefficient. The current executor also writes to a file every time something is to be executed and runs SWIPL from the PATH.
What's here so far
unsafe
things thatswipl-rs
doesn't exposeWhat's to come (many probably in separate PRs)
assertz
-ing at runtime.unsafe
if possible, just to decrease the surface of possible memory safety bugs