rems-project / sail

Sail architecture definition language
Other
563 stars 92 forks source link

Add interval type to AST #561

Closed Timmmm closed 1 month ago

Timmmm commented 1 month ago

Add an enum for .., >.., ..< to the AST and thread it through the types. It is not handled in most of the code, and many places are still hard-coded to use ..

This compiles but I don't really know what I'm doing and there's a lot of code so any help would be appreciated! Do you think we can get this into a state so it can be merged, and then start fixing all the places that need to take ival into account?

Also I realised interval is not really that great a name since it's not an interval on it's own. Probably should be called a range operator (range_op?) or something? Happy to rename if you can think of something better.

github-actions[bot] commented 1 month ago

Test Results

    9 files  ±0     20 suites  ±0   0s :stopwatch: ±0s   641 tests ±0    641 :white_check_mark: ±0  0 :zzz: ±0  0 :x: ±0  2 053 runs  ±0  2 052 :white_check_mark: ±0  1 :zzz: ±0  0 :x: ±0 

Results for commit 5ab3bd0b. ± Comparison against base commit bf1087f3.

Alasdair commented 1 month ago

Looks good so far. Maybe the way to go would be to make this a branch in this repository?

Most of the needed changes should be fairly simple, just a case of writing a bunch of tests and testing each individual backend.

Alasdair commented 1 month ago

I pushed this commit to https://github.com/rems-project/sail/tree/right_open_intervals, and I added another commit with type-checker modifications and some tests

Timmmm commented 1 month ago

Thanks! I'll close this and start making MRs to that branch.

Alasdair commented 1 month ago

Ok, I'll try not to force push to that branch. I did go a bit further and set up the C/OCaml/Interpreter primitives, with some tests for those.

Timmmm commented 1 month ago

Force pushing is fine as long as you

git config --global alias.pushf 'push --force-with-lease --force-if-includes'

and then git pushf. I don't know why the Git developers fix everything with --use-sensible-behaviour flags that nobody knows about...