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

Integrate menhir parser and elaborator tests #1220

Open
wants to merge 246 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
246 commits
Select commit Hold shift + click to select a range
1b4a6a4
Initial project organization & setup
green726 Jul 27, 2023
d6a6e95
preliminary & minimal implementation of the lexer
green726 Jul 27, 2023
88f5cc7
got initial version of parser to work - also added testing code
green726 Jul 27, 2023
5cfd56a
drastically expanded parser, lexer, ast (reworked pats vs exps, added…
green726 Jul 29, 2023
4659076
added cases & rules
green726 Jul 29, 2023
a3c77ed
Expanded the patterns and changed rules/cases
green726 Aug 3, 2023
7759144
Added arrow types & expanded test
green726 Aug 4, 2023
a01b07c
formatting
green726 Aug 4, 2023
556e8b4
Merge branch 'dev' into menhir_parser
green726 Dec 12, 2023
c32dfb2
started working on the menhir ast -> DHExp translation - got the simp…
green726 Dec 12, 2023
bfe2db1
Merge branch 'dev' into menhir_parser
green726 Jan 17, 2024
9080650
finished up preliminary translation
green726 Jan 17, 2024
af03c40
Added in the cast syntax to the menhir parser; still need to test
green726 Feb 16, 2024
8aff486
Merge remote-tracking branch 'origin/dev' into menhir_parser
7h3kk1d Feb 25, 2024
951d4a2
Reformat
7h3kk1d Feb 25, 2024
97c5187
Integrate menhir tests with the haz3ltests
7h3kk1d Feb 25, 2024
3bc4227
Try failing test
7h3kk1d Feb 25, 2024
191639e
Merge branch 'dev' into menhir_tests
green726 Mar 11, 2024
db3b918
fixed the menhir parser test for integer literal
green726 Mar 12, 2024
cdfc8ad
fixing some bugs with the functions expressions in the menhir parser
green726 Mar 12, 2024
d3a5995
changed the elaborator test to start adding in Menhir tests - some is…
green726 Mar 20, 2024
8ecd025
modified the menhir parser to have manual annotations for fun exp typ…
green726 Apr 2, 2024
16b7e4a
added support for the holes, closures, hole ids, and free vars
green726 Apr 3, 2024
e3060a7
added inconsistent branch handling to the menhir parser for testing b…
green726 Apr 5, 2024
6b13317
reworked hole syntax + added unknown types + changed expression parsi…
green726 Apr 6, 2024
0448846
fixed the ifthenelse menhir -> dhexp translation + added menhir ifthe…
green726 Apr 6, 2024
595c6f7
added if consistency & test case for inconsistent if
green726 Apr 8, 2024
2ba24df
cleaned up the test_elaboration file and removed all non-menhir tests
green726 Apr 22, 2024
a4d7a93
added the docs as well as cons, seqs, and test to menhir parser
green726 Apr 22, 2024
76d1ef8
added in the remaining pat forms & docs, cleaned up some of the code,…
green726 Apr 22, 2024
b10b8ac
merged main into menhir_test
green726 Apr 22, 2024
cd8ae48
finished fixing conflicts with the elaborator file & new tests direct…
green726 Apr 22, 2024
a33b30d
changed the hole syntax to align with Cyrus comments; changed menhir …
green726 Apr 26, 2024
27be64a
fixed parser build error, updated DHPat and Typ docs to new menhir te…
green726 May 27, 2024
971945c
updated menhir elaboration unit tests to new menhir dhexp syntax
green726 May 27, 2024
d9d07f9
changed the fixf to match hazel syntax without menhir conflict
green726 May 28, 2024
cc2b5dc
renamed the menhir parser to match hazel naming conventions
green726 Jun 7, 2024
4aed0bc
updated elaboration tests to the new menhir parser module name
green726 Jun 7, 2024
33cb84a
updated the menhir parser to the new universal exp format; merged men…
green726 Jun 28, 2024
d91c550
merged remove dhexp updated elaboration tests into the elaboration me…
green726 Jun 28, 2024
56ceaf8
updated elaborator tests to use the new unified Exp menhir parser
green726 Jun 28, 2024
834a803
Added documentation for exp menhir textual syntax
green726 Jun 28, 2024
8af6998
Updated some of the textual exp syntax with the menhir parser
green726 Jul 25, 2024
3317133
Merge branch 'dev' into menhir_tests
green726 Aug 2, 2024
a783dd5
Fixed conflicts from recent update to dev
green726 Aug 5, 2024
d27ff09
Added more elaboration tests & added in DynamicErrorHole menhir parsing
green726 Aug 7, 2024
e81fbdb
Added in sexp serialization for InvalidOperationError test
green726 Aug 12, 2024
5b71bd9
Added in elaboration tests for undef, filter action, and builtin
green726 Aug 12, 2024
dfa56af
Cleaned up some comments & updated the menhir parser tests
green726 Aug 15, 2024
aefea80
More merge cleanups
green726 Aug 18, 2024
196c910
Merge branch 'dev' into menhir_tests
green726 Aug 18, 2024
d8bdd8f
Moved the menhir -> dhexp conversion logic to haz3lmenhir from haz3lcore
green726 Aug 23, 2024
ffe5ef9
Removed MultiHoles from the Menhir parser
green726 Aug 27, 2024
47ffe3e
Resolved about 50% of the shift/reduce conflicts in the menhir parser
green726 Sep 7, 2024
de59c41
Finished resolving shift/reduce conflicts in the menhir parser
green726 Sep 13, 2024
9246a07
Fixed precedence issues in the menhir parser; tests now run sucessfully
green726 Sep 13, 2024
cf736fa
Added some more menhir-based elaboration tests
green726 Oct 2, 2024
b7481c7
Added menhir elaboration tests for list concat, minus unop & fixed me…
green726 Oct 2, 2024
cf7b720
Added menhir elaboration test for seq, fixf
green726 Oct 2, 2024
804aada
Merge branch 'dev' into menhir_tests
green726 Oct 2, 2024
079754b
Fixing issue with dev -> menhir tests merge
green726 Oct 2, 2024
b852d0f
Merge branch 'dev' into menhir_tests
green726 Oct 4, 2024
4c4eeb9
Removed some menhir elaboration test debug code
green726 Oct 6, 2024
850d247
Fix formatting
7h3kk1d Oct 6, 2024
935f842
Move menhir elaboration tests into module
7h3kk1d Oct 6, 2024
dab05cb
Add back plain elaboration tests
7h3kk1d Oct 6, 2024
dc51508
Use alco_check_menhir in all the menhir elaboration tests
7h3kk1d Oct 6, 2024
f2e14fe
Added menhir parser readme
green726 Oct 14, 2024
dd7dd80
Started restructuring the menhir parser tests
green726 Oct 14, 2024
39d077f
Add additional parser tests
7h3kk1d Oct 24, 2024
ce26173
Add more menhir tests including a failing constructor test
7h3kk1d Oct 24, 2024
01d6f3a
Add more tests
7h3kk1d Oct 24, 2024
9a3b5dd
Add test for parsing named function
7h3kk1d Oct 24, 2024
aef64e9
Add test for parsing named function and additional parser tests
7h3kk1d Oct 24, 2024
15a82a0
Refmt
7h3kk1d Oct 24, 2024
4a2fe8b
Change constructor tests
7h3kk1d Oct 25, 2024
00ab1de
Fix filter parsing
7h3kk1d Oct 25, 2024
be06410
Fix integer operator test
7h3kk1d Oct 25, 2024
6b1c3b0
Simplify test
7h3kk1d Oct 25, 2024
51ec3c4
Add a test that compares the menhir parser to maketerm with the basic…
7h3kk1d Oct 25, 2024
ed962c0
Add haz3lweb library to test dependencies
7h3kk1d Oct 25, 2024
9d2b7db
More menhir parser tests added
green726 Oct 28, 2024
f5886c3
Fixed some menhir parser precedence bugs; added more menhir parser te…
green726 Oct 29, 2024
efdbdc7
Merge remote-tracking branch 'origin/dev' into menhir_tests
7h3kk1d Oct 30, 2024
17880ce
Merge branch 'coverage' into menhir_tests
7h3kk1d Oct 31, 2024
d8f2652
Add coverage instrumentation to haz3lmenhir library
7h3kk1d Oct 31, 2024
eb5ba2b
Added hole replacement to the basic_reference parser test
green726 Nov 4, 2024
1cc26f6
Merge branch 'menhir_tests' of github.com:hazelgrove/hazel into menhi…
green726 Nov 4, 2024
6b36552
Merges
green726 Nov 4, 2024
574c359
Reworked the constructor menhir parsing to match maketerm
green726 Nov 4, 2024
8b79893
Fixed the invalid reduce/reduce conflict and added LESS_THAN back int…
green726 Nov 4, 2024
c3de67f
Merge branch 'dev' into menhir_tests
7h3kk1d Nov 4, 2024
ac4e9f9
Fix variant constructor type in parser
7h3kk1d Nov 4, 2024
c5861cd
Add commented out test for constructor with a type variable
7h3kk1d Nov 4, 2024
1aec2b9
Add some commented out tests for type variables
7h3kk1d Nov 4, 2024
a265eb8
Add a commented out float operations test
7h3kk1d Nov 4, 2024
ff2aa0f
Mark failing tests as skipped
7h3kk1d Nov 4, 2024
d444d6e
Stop printing
7h3kk1d Nov 4, 2024
ad1ffec
Added type variables to the menhir parser
green726 Nov 7, 2024
decb9ec
Fix assert message for parser_test when menhir fails
7h3kk1d Nov 25, 2024
807dc8f
Some changed to the menhir parser for int operations
green726 Nov 25, 2024
993ad15
Merge branch 'menhir_tests' of github.com:hazelgrove/hazel into menhi…
green726 Nov 25, 2024
033bda3
Modifications to the menhir testing to fix the float ops testing and …
green726 Nov 26, 2024
13e968f
Started to add sum types to the menhir parser & temporarily changed m…
green726 Dec 1, 2024
24a4588
Updated menhir elaboration tests to match new menhir casting syntax
green726 Dec 1, 2024
6d816f4
Fixed the shift/reduce conflict with the sum types in the menhir parser
green726 Dec 1, 2024
8335bfe
Added initial version of menhir sum type -> hazel sum type conversion
green726 Dec 1, 2024
a01348a
Readd comparison with MakeTerm for tests and add basic sum type test
7h3kk1d Dec 2, 2024
93251b8
Update integer and float ops tests and fix some assertion messages
7h3kk1d Dec 2, 2024
f202efd
Stop skipping integer ops
7h3kk1d Dec 2, 2024
115d4e2
Fix integer and float precedences
7h3kk1d Dec 2, 2024
b5ed4c3
Fixed the menhir sum type parsing & conversion to match hazel sum typ…
green726 Dec 2, 2024
6391f8e
Removed parser automaton and conflicts
green726 Dec 2, 2024
497ea3f
Make tests for every documentation buffer
7h3kk1d Dec 2, 2024
a6f0f03
Print doc buffer source text before test
7h3kk1d Dec 2, 2024
3ea7cb5
Add test for empty type holes
7h3kk1d Dec 2, 2024
3b72ec2
Add EmptyHole type to menhir
7h3kk1d Dec 3, 2024
66de4a3
Added test
7h3kk1d Dec 3, 2024
5d2c5e8
incremental progress on parser arrow/colon precedence
7h3kk1d Dec 4, 2024
286352d
Add parens around ascription in function pattern for tests
7h3kk1d Dec 9, 2024
87729b9
More progress on parser
7h3kk1d Dec 9, 2024
a76f253
Fix unused variable
7h3kk1d Dec 9, 2024
3d06374
Update Init.ml file with parentheses on function args
7h3kk1d Dec 9, 2024
cfc4180
Manually curate documentation buffers to account for menhir differenc…
7h3kk1d Dec 13, 2024
be85171
Add forall to AST
7h3kk1d Dec 13, 2024
7904db5
Add forall, unit exp to parser
7h3kk1d Dec 13, 2024
94bec54
Merge remote-tracking branch 'origin/dev' into menhir_tests
7h3kk1d Dec 13, 2024
f450850
Make assertion more restrictive
7h3kk1d Dec 13, 2024
f96e3d2
Fix sequence precedence
7h3kk1d Dec 13, 2024
e7f8e61
Fix and ap precedence
7h3kk1d Dec 13, 2024
aa34712
Stripped parens in tests
7h3kk1d Dec 13, 2024
773583f
Fix negation precedence
7h3kk1d Dec 13, 2024
5bb8b18
Stop having singleton tuple types
7h3kk1d Dec 13, 2024
97dd32d
Fix cons association
7h3kk1d Dec 13, 2024
abfccdf
Fix arrow associativity
7h3kk1d Dec 13, 2024
7929bcc
Add tests for polymorphism documentation buffer
7h3kk1d Dec 13, 2024
dbdc108
Temporary fix for some failing tests on builtins
7h3kk1d Dec 13, 2024
1465aa5
Add todo about literal t in t_typ
7h3kk1d Dec 14, 2024
a7aa733
Add rec type
7h3kk1d Dec 14, 2024
9e997a3
Polymorphism buffer parsing
7h3kk1d Dec 14, 2024
978e65e
Fix precedence between less than and &&
7h3kk1d Dec 14, 2024
5ecdfc6
Tighten assertions on tests
7h3kk1d Dec 14, 2024
d7423f1
Start reverse conversion
7h3kk1d Dec 14, 2024
a860c6a
Fix ExpToSegment float serialization
7h3kk1d Dec 15, 2024
4e5379c
Stop negative floats and ints
7h3kk1d Dec 15, 2024
8c3b753
Start using qcheck to test parser
7h3kk1d Dec 15, 2024
542f10f
Add lists to pbt for menhir
7h3kk1d Dec 15, 2024
ee3b6bf
Start tuple generator
7h3kk1d Dec 15, 2024
f90e146
Fix tuple generator
7h3kk1d Dec 15, 2024
f988005
Reduce size of generator to speed up test
7h3kk1d Dec 15, 2024
91476cb
Fixed the shift/reduce error with new fun exps
green726 Dec 15, 2024
60f5709
Merge branch 'menhir_tests' of github.com:hazelgrove/hazel into menhi…
green726 Dec 15, 2024
d13e07c
Fixed the single character invalid form annotations in the menhir parser
green726 Dec 15, 2024
92b9d5d
Make AST sum type closer to Haz3lcore
7h3kk1d Dec 16, 2024
36307a9
Forgot to commit parser
7h3kk1d Dec 16, 2024
bef0026
Change AST generator ident to use full a-z
7h3kk1d Dec 16, 2024
e2f5f72
Add some more leaf generators
7h3kk1d Dec 16, 2024
8288d7a
Reenable unit generation
7h3kk1d Dec 16, 2024
c77d065
Add constructors to generator and exclude keywords
7h3kk1d Dec 16, 2024
3d11a0d
Formatting
7h3kk1d Dec 16, 2024
428faaa
Fix constructor ident
7h3kk1d Dec 16, 2024
956fb32
Several operator precedence improvements as well as a generator for b…
7h3kk1d Dec 16, 2024
39f2999
Increase quickcheck test size to help find bugs
7h3kk1d Dec 17, 2024
ca2a0c0
Update String concat precedence to match Precedence.re
7h3kk1d Dec 17, 2024
5b2f3cf
Remove keywords from arb_constructor_ident
7h3kk1d Dec 17, 2024
ff0b325
More generators
7h3kk1d Dec 17, 2024
a96659c
Fix precedences
7h3kk1d Dec 17, 2024
4cd1e56
revert mistake
7h3kk1d Dec 17, 2024
e7af810
More generators for types
7h3kk1d Dec 17, 2024
b1da56a
Generate product types
7h3kk1d Dec 18, 2024
0710524
More generator fixes and adjusted float equality
7h3kk1d Dec 19, 2024
20bcba5
Merge remote-tracking branch 'origin/dev' into menhir_tests
7h3kk1d Dec 19, 2024
d762a74
Add deriving eq to menhir
7h3kk1d Dec 19, 2024
9eac896
Remove space from testsuite name
7h3kk1d Dec 19, 2024
1e44f9c
Add comment
7h3kk1d Dec 19, 2024
d535f5e
Add unit pattern
7h3kk1d Dec 19, 2024
ed36809
More pattern generation
7h3kk1d Dec 19, 2024
0e3353d
Added CastPat and ApPat generators
7h3kk1d Dec 19, 2024
57b3e8b
Add ArrayType to generator
7h3kk1d Dec 19, 2024
4a79a14
More patterns
7h3kk1d Dec 20, 2024
8436063
Clean up qcheck generator
7h3kk1d Dec 20, 2024
9c31795
Make ExpToSegment more resilient to missing ids
7h3kk1d Dec 20, 2024
cb0dac7
Add more typ generators
7h3kk1d Dec 20, 2024
dbc4d47
Add test for exp to segment
7h3kk1d Dec 20, 2024
5970942
reformat
7h3kk1d Dec 20, 2024
524547f
Add Test_ExpToSegment to test runner
7h3kk1d Dec 20, 2024
d5db2df
Fix ApPat
7h3kk1d Dec 20, 2024
80f744f
Cleanup constructor generator
7h3kk1d Dec 20, 2024
bd9fd3c
Fix a precedence
7h3kk1d Dec 20, 2024
9839e5e
Back to a 100 tests
7h3kk1d Dec 20, 2024
0bba4b1
Readd qcheck
7h3kk1d Dec 20, 2024
54e19f4
Enhance ExpToSegment tests with constructor and match statement cases
7h3kk1d Dec 20, 2024
f5595e7
Add case generation for expressions
7h3kk1d Dec 20, 2024
618a4d9
More expression generation
7h3kk1d Dec 20, 2024
c9556ef
Added deferrals and filters to generators
7h3kk1d Dec 20, 2024
f3e4349
Adjust if precedence
7h3kk1d Dec 20, 2024
d0a7a76
Generate sequences
7h3kk1d Dec 20, 2024
680a25c
Precedence of cons
7h3kk1d Dec 20, 2024
419f9e3
Generate cons
7h3kk1d Dec 20, 2024
1f06f00
enable ListConcat generation
7h3kk1d Dec 20, 2024
21d34fe
Fix tpat arb instance
7h3kk1d Dec 20, 2024
bea13f7
Refactor tpat and pat types; simplify arb generation and remove unuse…
7h3kk1d Dec 20, 2024
21bcfbf
Add failing test for concat and typap
7h3kk1d Dec 20, 2024
28d60bd
Fix TypAp with lexing operator
7h3kk1d Dec 20, 2024
cfda148
Remove debug code
7h3kk1d Dec 20, 2024
88341f3
List concat/cons precedence
7h3kk1d Dec 20, 2024
2936215
ExpToSegment more resilient without ids
7h3kk1d Dec 20, 2024
9fd16cc
sum types non-empty generator
7h3kk1d Dec 20, 2024
1ce5144
Add parens to tuples, sums, and records when converting
7h3kk1d Dec 20, 2024
d508eec
Adjust cast precedence
7h3kk1d Dec 20, 2024
0059289
Add parens around forall and rectype to help with ambiguities
7h3kk1d Dec 20, 2024
c485ea5
Address some remaining inconsistencies with generation
7h3kk1d Dec 20, 2024
d8bf5e1
Commenting out skipped tests because of bug in Junit_alcotest
7h3kk1d Dec 20, 2024
56b3291
Remove unused basic_reference.txt
7h3kk1d Dec 20, 2024
30e0af4
Revert pp formatting for id tagged
7h3kk1d Dec 20, 2024
896224d
revert formatting change
7h3kk1d Dec 20, 2024
3b3087b
Revert formatting change
7h3kk1d Dec 20, 2024
6f38eb6
Revert term base to dev
7h3kk1d Dec 20, 2024
ad9ddfa
Remove debug statements
7h3kk1d Dec 20, 2024
44caaa0
Cleaning up tests
7h3kk1d Dec 20, 2024
57de33c
More test cleanup
7h3kk1d Dec 20, 2024
a7c80e9
More cleanup
7h3kk1d Dec 20, 2024
57b0a1d
Address todos in Conversion
7h3kk1d Dec 20, 2024
ebe9380
Rename binop
7h3kk1d Dec 20, 2024
dd4dffa
Adjust comment
7h3kk1d Dec 20, 2024
db04947
Remove todo
7h3kk1d Dec 20, 2024
5cdb818
Simplify qualified imports
7h3kk1d Dec 22, 2024
d220808
Refactor gen_exp_sized to use let* for improved readability and struc…
7h3kk1d Dec 22, 2024
423d874
Finish converting gen_exp to let notation
7h3kk1d Dec 22, 2024
8deebf7
Refmt
7h3kk1d Dec 22, 2024
ccda1d2
Refactor gen_typ_sized to use let notation
7h3kk1d Dec 22, 2024
109f130
Refactor sumtype to use let notation
7h3kk1d Dec 22, 2024
64d1a04
Refactor gen_pat_sized to use let notation
7h3kk1d Dec 22, 2024
ea51395
Remove unused gen_exp and gen_typ definitions
7h3kk1d Dec 22, 2024
98e7730
Rename arb_str to arb_alpha_str
7h3kk1d Dec 22, 2024
ce23f3f
Inlining cleanup
7h3kk1d Dec 22, 2024
acc2fca
Refactor to gen_literal_string
7h3kk1d Dec 22, 2024
926ab68
More let notation
7h3kk1d Dec 22, 2024
7472c64
Add annotation
7h3kk1d Dec 22, 2024
24ebb17
Cleanup
7h3kk1d Dec 22, 2024
6618e86
Turn arb_constructor_ident into gen_constructor_ident
7h3kk1d Dec 22, 2024
35ddd72
Rename generators
7h3kk1d Dec 22, 2024
9620c17
Add detailed documentation for generator functions in AST
7h3kk1d Dec 22, 2024
ae1ae3d
Remove TODO comment regarding builtins in the parser
7h3kk1d Dec 22, 2024
ce578a3
Remove invalid deferral test
7h3kk1d Dec 22, 2024
a5b5421
Upgrade junit_alcotest to 2.1.0 and uncomment skipped tests
7h3kk1d Dec 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions dune-project
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(lang dune 3.16)

(using menhir 2.0)

(name hazel)
Expand All @@ -9,15 +10,17 @@
(github hazelgrove/hazel))

(authors "Hazel Development Team")

(maintainers "Hazel Development Team")

(license MIT)

(package
(name hazel)
(allow_empty)
(synopsis "Hazel, a live functional programming environment with typed holes")
; (description "A longer description")
(synopsis
"Hazel, a live functional programming environment with typed holes")
; (description "A longer description")
; (tags
; (topics "to describe" your project))
(depends
Expand All @@ -26,20 +29,31 @@
(menhir
(>= 2.0))
yojson
(reason (>= 3.12.0))
(reason
(>= 3.12.0))
ppx_yojson_conv_lib
ppx_yojson_conv
incr_dom
bisect_ppx
(omd (>= 2.0.0~alpha4))
(omd
(>= 2.0.0~alpha4))
ezjs_idb
bonsai
ppx_deriving
ptmap
(uuidm (= 0.9.8)) ; 0.9.9 has breaking deprecated changes
(uuidm
(= 0.9.8)) ; 0.9.9 has breaking deprecated changes
unionFind
ocamlformat
(junit_alcotest :with-test)
ocaml-lsp-server)) ; After upgrading to opam 2.2 use with-dev https://opam.ocaml.org/blog/opam-2-2-0/
(junit_alcotest
(and
(>= 2.1.0)
:with-test))
ocaml-lsp-server
qcheck
qcheck-alcotest
ppx_deriving_qcheck))

; After upgrading to opam 2.2 use with-dev https://opam.ocaml.org/blog/opam-2-2-0/

; See the complete stanza docs at https://dune.readthedocs.io/en/stable/reference/dune-project/index.html
6 changes: 5 additions & 1 deletion hazel.opam

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 10 additions & 4 deletions hazel.opam.locked

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/haz3lcore/lang/Form.re
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ let forms: list((string, t)) = [
("divide", mk_infix("/", Exp, P.mult)),
("equals", mk_infix("==", Exp, P.eqs)),
("string_equals", mk_infix("$==", Exp, P.eqs)),
("string_concat", mk_infix("++", Exp, P.plus)),
("string_concat", mk_infix("++", Exp, P.concat)),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes it consistent with Precedence.re

("lt", mk_infix("<", Exp, P.eqs)),
("gt", mk_infix(">", Exp, P.eqs)),
("not_equals", mk_infix("!=", Exp, P.eqs)),
Expand Down
27 changes: 22 additions & 5 deletions src/haz3lcore/pretty/ExpToSegment.re
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ let rec exp_to_pretty = (~settings: Settings.t, exp: Exp.t): pretty => {
| Int(n) => text_to_pretty(exp |> Exp.rep_id, Sort.Exp, Int.to_string(n))
// TODO: do floats print right?
| Float(f) =>
text_to_pretty(exp |> Exp.rep_id, Sort.Exp, Float.to_string(f))
text_to_pretty(exp |> Exp.rep_id, Sort.Exp, Printf.sprintf("%f", f))
| String(s) =>
text_to_pretty(exp |> Exp.rep_id, Sort.Exp, "\"" ++ s ++ "\"")
// TODO: Make sure types are correct
Expand Down Expand Up @@ -475,7 +475,7 @@ and pat_to_pretty = (~settings: Settings.t, pat: Pat.t): pretty => {
| Var(v) => text_to_pretty(pat |> Pat.rep_id, Sort.Pat, v)
| Int(n) => text_to_pretty(pat |> Pat.rep_id, Sort.Pat, Int.to_string(n))
| Float(f) =>
text_to_pretty(pat |> Pat.rep_id, Sort.Pat, Float.to_string(f))
text_to_pretty(pat |> Pat.rep_id, Sort.Pat, Printf.sprintf("%f", f))
| Bool(b) => text_to_pretty(pat |> Pat.rep_id, Sort.Pat, Bool.to_string(b))
| String(s) =>
text_to_pretty(pat |> Pat.rep_id, Sort.Pat, "\"" ++ s ++ "\"")
Expand Down Expand Up @@ -543,11 +543,28 @@ and typ_to_pretty = (~settings: Settings.t, typ: Typ.t): pretty => {
let go = typ_to_pretty(~settings: Settings.t);
let go_constructor: ConstructorMap.variant(Typ.t) => pretty =
fun
| Variant(c, ids, None) => text_to_pretty(List.hd(ids), Sort.Typ, c)
| Variant(c, ids, None) => {
text_to_pretty(
Option.value(~default=Id.invalid, ListUtil.hd_opt(ids)),
Sort.Typ,
c,
);
}
| Variant(c, ids, Some(x)) => {
let+ constructor =
text_to_pretty(List.hd(List.tl(ids)), Sort.Typ, c);
constructor @ [mk_form("ap_typ", List.hd(ids), [go(x)])];
text_to_pretty(
Option.value(~default=Id.invalid, ListUtil.nth_opt(1, ids)),
Sort.Typ,
c,
);
constructor
@ [
mk_form(
"ap_typ",
Option.value(~default=Id.invalid, ListUtil.hd_opt(ids)),
[go(x)],
),
];
}
| BadEntry(x) => go(x);
switch (typ |> Typ.term_of) {
Expand Down
Loading
Loading