Jean-Alexandre Barszcz pushed to branch ja-refl at Stefan / Typer
Commits:
50069ddc by Shon Feder at 2022-03-11T20:42:03-05:00
Add Zarith dependency to opam file
Also adds "synopsis" and "description" fields, with content taken from
https://www.iro.umontreal.ca/~monnier/
- - - - -
12c08fbb by Shon Feder at 2022-03-11T20:42:03-05:00
Ignore the opam switch directory
- - - - -
a2bc3d5c by Stefan Monnier at 2022-05-10T14:50:33-04:00
* src/debruijn.ml (senv_lookup): Fix ordering of tests
- - - - -
c422f432 by “falismai(a)iro.umontreal.xn--ca-02t at 2022-05-26T18:51:50+00:00
[OK] Compilateur
- - - - -
cbd1e53a by “falismai(a)iro.umontreal.xn--ca-02t at 2022-05-31T20:45:09+00:00
Ajout du type sinfo
- - - - -
471c1ff6 by “falismai(a)iro.umontreal.xn--ca-02t at 2022-05-31T20:52:07+00:00
Ajout du type sinfo pour Sexp-info
- - - - -
f0551384 by Stefan Monnier at 2022-08-27T14:07:24-04:00
Merge branch 'add-zarith-dependency' into 'main'
See merge request monnier/typer!2
- - - - -
525e358e by Simon Génier at 2022-08-28T22:37:40-04:00
Add a test for type ascription.
Also improve how discrepancies in sexp tests are reported.
- - - - -
2a824e2d by Simon Génier at 2022-08-28T22:39:23-04:00
Pretty-prints the code emitted by the Gambit backend.
It spawns Gambit as a subprocess and delegates the pretty-printing to it. We
only have to worry about emitting valid code. I intend to use the inferior
Gambit mechanism to also implement a REPL.
- - - - -
cc46ac0a by Simon Génier at 2022-09-02T14:34:57-04:00
Fix off by one error on line numbers.
The source_file object start in a kind of null state, with an empty line,
causing to read the first line lazily as the first char is peeked. This means we
need to put the cursor before the first line and not on the first line!
- - - - -
29c3f091 by Simon Génier at 2022-09-02T14:36:31-04:00
Merge branch 'oops-fix-off-by-one-error-on-line-numbers'
- - - - -
ef72535e by Jean-Alexandre Barszcz at 2022-09-28T22:20:38-04:00
[WIP] Don't close the types of builtins
`lexp_close` introduces redundant definitions with
let-expressions. Instead of closing the built-in (with their type), we
keep track of their context (length) and shift them appropriately
where they are used.
- - - - -
acf0b570 by Jean-Alexandre Barszcz at 2022-10-12T03:24:48-04:00
[WIP] Add an internal name ("id") to make typecons more nominal
Comparing all the constructors and parameters of typeconses for
conversion is slow. This commit takes the easy and short approach, by
minimally changing the `Inductive` constructor and only adding an
internal name. Conversion is checked by comparing this internal name,
which is faster. However, type safety relies on the proper use of this
name.
Design constraints: I would like to
1. be able to escape the nominal paradigm and refer to a typecons
by value if needed (if its internal name is known).
2. not influence the property that the pretty printed code can be
re-elaborated. A challenge here is that typeconses can be
substituted through the code, so they have to be "pure".
3. avoid larger changes to the context (if the formal parameter
and constructor info is not present in the typecons, it has to be
somewhere in the context).
Another option meeting these requirement would be to add an
indirection (eg. `typeconsref`) to `lexp` that is not substituted like
normal variables, but still points to the typecons in context. The
elaboration of inductives would bind the typecons and return a
reference to it.
This indirection would take care of the redundancy of the current
representation and avoid inconsistencies, but require a bit more work
to implement.
- - - - -
35c30984 by Jean-Alexandre Barszcz at 2022-11-09T01:20:59-05:00
[WIP] Fix predefs; Reflect lists and S-exps
- - - - -
53a58925 by Jean-Alexandre Barszcz at 2022-11-09T13:04:39-05:00
[WIP] Remove Vsexp from value_type
- - - - -
511daa3a by Jean-Alexandre Barszcz at 2022-11-09T13:05:47-05:00
[WIP] Replace the Sexp builtins by regular constructors
- - - - -
29 changed files:
- .gitignore
- + .idea/workspace.xml
- btl/builtins.typer
- btl/pervasive.typer
- debug_util.ml
- opam
- src/builtin.ml
- src/debruijn.ml
- src/debug.ml
- src/dune
- src/elab.ml
- src/elexp.ml
- src/env.ml
- src/eval.ml
- src/fmt.ml
- src/gambit.ml
- src/heap.ml
- src/instargs.ml
- src/inverse_subst.ml
- src/lexp.ml
- src/opslexp.ml
- src/pexp.ml
- src/positivity.ml
- + src/predefs.ml
- + src/pretty-printer.scm
- src/sexp.ml
- src/source.ml
- src/unification.ml
- src/util.ml
The diff was not included because it is too large.
View it on GitLab: https://gitlab.com/monnier/typer/-/compare/dc04f51bd034814b4d743881ed4903b5…
--
View it on GitLab: https://gitlab.com/monnier/typer/-/compare/dc04f51bd034814b4d743881ed4903b5…
You're receiving this email because of your account on gitlab.com.
Simon Génier pushed to branch gambit-compile-pervasives at Stefan / Typer
Commits:
c6e03ab0 by Simon Génier at 2022-11-04T16:43:26-04:00
Print multiline locations.
- - - - -
1 changed file:
- src/source.ml
Changes:
=====================================
src/source.ml
=====================================
@@ -175,31 +175,60 @@ module Location = struct
let display_context (location : t) (f : formatter)
: unit =
+ let print_within line_number =
+ let line = Container.nth_line location.container line_number in
+ let before = String.sub line 0 location.start_offset in
+ let focus =
+ String.sub
+ line
+ location.start_offset
+ (location.end_offset - location.start_offset)
+ in
+ let after =
+ String.sub
+ line
+ location.end_offset
+ (String.length line - location.end_offset)
+ in
+ fprintf f "%d | %s@{<cyan>%s@}%s@." line_number before focus after;
+ in
+
+ let print_start_line line_number start_offset =
+ let line = Container.nth_line location.container line_number in
+ let before = String.sub line 0 start_offset in
+ let focus =
+ String.sub line start_offset (String.length line - start_offset)
+ in
+ fprintf f "%d | %s@{<cyan>%s@}@." line_number before focus;
+ in
+
+ let print_middle_line line_number =
+ let line = Container.nth_line location.container line_number in
+ fprintf f "%d | @{<cyan>%s@}@." line_number line;
+ in
+
+ let print_end_line line_number end_offset =
+ let line = Container.nth_line location.container line_number in
+ let focus = String.sub line 0 end_offset in
+ let after = String.sub line end_offset (String.length line - end_offset) in
+ fprintf f "%d | @{<cyan>%s@}%s@." line_number focus after;
+ in
+
if location != dummy
then begin
fprintf
f " → In: @{<green>%s@}@."
(Container.name location.container);
if location.start_line = location.end_line
- then
- let line = Container.nth_line location.container location.start_line in
- let before = String.sub line 0 location.start_offset in
- let focus =
- String.sub
- line
- location.start_offset
- (location.end_offset - location.start_offset)
- in
- let after =
- String.sub
- line
- location.end_offset
- (String.length line - location.end_offset)
- in
- fprintf f "%d | %s@{<cyan>%s@}%s@." location.start_line before focus after;
- else
- failwith "TODO"
+ then print_within location.start_line
+ else begin
+ print_start_line location.start_line location.start_offset;
+ for line_number = location.start_line + 1 to location.end_line - 1 do
+ print_middle_line line_number;
+ done;
+ print_end_line location.end_line location.end_offset;
end
+ end
end
(** A source object is text paired with a cursor. *)
View it on GitLab: https://gitlab.com/monnier/typer/-/commit/c6e03ab0f974d75cc87a3a15184172fda…
--
View it on GitLab: https://gitlab.com/monnier/typer/-/commit/c6e03ab0f974d75cc87a3a15184172fda…
You're receiving this email because of your account on gitlab.com.