Skip to content
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

More transpiler functionality and fixes from Sprint 2 (started Aug 29) #431

Merged
merged 58 commits into from
Sep 17, 2023

Conversation

ym-han
Copy link
Contributor

@ym-han ym-han commented Sep 17, 2023

This PR fixes some of the bugs in the transpiler and adds more functionality. In a nutshell, most of the functionality required by the current encoding should be there, though there's still work to be done on testing, making the design more modular, improving error diagnostics, etc.

In particular, this PR

  • implements support for the ditto syntax in the transpiler
  • improves handling of RPrels in SimplifyL4.hs
  • adds more graceful error handling in SimplifyL4.hs
  • adds some notes on LE syntax in README.md
  • implements replacement of '%', '.', ','. These are currently hard-coded; in the future we can read in a .tsv with the desired replacements, a .tsv that can then be kept in sync with the web app side (since that also needs to be able to run the replacements in the other direction).
  • filters out superfluous templates, in part with heuristics --- we now filter out NLAs/templates that are subsumed by lib templates, as well as (i) the templates that have fewer vars than the templates whose regexes match them and (ii) templates with the same number of vars but that are less informative
  • generically derives prisms and other useful optics for the L4 Rule datatype

We can try to cache the PCRE installation step in the github workflow more effectively in future work.

Co-authored-by: johsi-k johsi.k@gmail.com

it’s quite important that
* there not be empty cells in the head or body between contentful cells,
* there not be `""` below the `DECIDE` --- if there are `""` below the `DECIDE`, then the stuff below will get parsed as distinct Hornlikes but without the givens, and the only way to then figure out what the original givens were will be very fragile
…e: Check upfront for wehther there are non-text mtexpr variable names in the GIVENs; raise a `dispute` if so and print warning as comment in resulting .le
…eamline the code (remove overly complicated typeclass typeapplications stuff) while still getting compiler support for subtypes of RPRel, by using GADTs and my own RPRel-esque type

2. Add support for arith comparison
…nt places in NLAs (instead of just 'a var') and for more nuanced filtering downstream
…g NLA has more vars than the subsumed one), among the non-lib NLAs. (Will need to handle subsumed but same-num-of-vars NLAs separately.)
…port the `NLA` record without exporting the accessors
…LENLA`; and add `regextravifyNLASection :: T.Text -> Maybe [RegexTrav]`
…subsumed (etc) NLAs into one place (in LE.hs), to make code more modular and readable
…t-up-to-varnames (with same number of vars) NLAs
… var names (and have the same number of vars) as comments in case the user didn't mean for them to be removed
… of having `isReg` and `isHlike` functions, to avoid confusing people
@ym-han ym-han force-pushed the aug29-more-le-transpiler-fixes branch from 2757151 to 725a4c4 Compare September 17, 2023 18:29
@ym-han ym-han merged commit 0b6cbc4 into main Sep 17, 2023
3 checks passed
@ym-han ym-han deleted the aug29-more-le-transpiler-fixes branch September 17, 2023 19:13
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