Master merges into the as-chain lane.
This commit is contained in:
commit
c4547adb25
1
TODO.org
1
TODO.org
@ -38,6 +38,7 @@ prelude and vendor rewritten in .fln; tests and examples converted with =flan co
|
|||||||
then =flan convert=, the .flan source path and =flan-mode= removed. Nothing tracks what
|
then =flan convert=, the .flan source path and =flan-mode= removed. Nothing tracks what
|
||||||
.flan can no longer say. Step 1 is done: the name rule with the =is-=/=has-= renames
|
.flan can no longer say. Step 1 is done: the name rule with the =is-=/=has-= renames
|
||||||
through the prelude, vendor and raylib, and =T?=, =??=, =x!=, =if let g = x= and =a?.b=.
|
through the prelude, vendor and raylib, and =T?=, =??=, =x!=, =if let g = x= and =a?.b=.
|
||||||
|
Step 2's prelude is done: =lib/prelude.fln=, read by the indented reader.
|
||||||
** DONE x? tests presence, and narrows
|
** DONE x? tests presence, and narrows
|
||||||
CLOSED: [2026-09-26]
|
CLOSED: [2026-09-26]
|
||||||
Decided (133): =x?= is a bool; =if x?=, =elif x?=, =while x?= and the rest of an =and=
|
Decided (133): =x?= is a bool; =if x?=, =elif x?=, =while x?= and the rest of an =and=
|
||||||
|
|||||||
@ -7527,7 +7527,7 @@ prints freed memory.
|
|||||||
|
|
||||||
## String is a prelude struct, and the checker is its wall
|
## String is a prelude struct, and the checker is its wall
|
||||||
|
|
||||||
`String` is `(defstruct String [bytes (Vec u8)])` in `lib/prelude.ml`, so its
|
`String` is `struct String(bytes: Vec(u8))` in `lib/prelude.fln`, so its
|
||||||
allocator, free, retry on exhaustion and dev-registry notes are the Vec's and
|
allocator, free, retry on exhaustion and dev-registry notes are the Vec's and
|
||||||
neither backend has a String of its own. What makes it always valid UTF-8 is
|
neither backend has a String of its own. What makes it always valid UTF-8 is
|
||||||
`lib/check.ml`'s String section: outside the prelude the field and the
|
`lib/check.ml`'s String section: outside the prelude the field and the
|
||||||
|
|||||||
@ -166,7 +166,7 @@ often `pause' itself, and `P' shows them.")
|
|||||||
|
|
||||||
(defconst flan-cnr-breakpoint "Pause"
|
(defconst flan-cnr-breakpoint "Pause"
|
||||||
"The condition `(pause)' signals.
|
"The condition `(pause)' signals.
|
||||||
`lib/prelude.ml' writes it as an ordinary struct under a `restart-case', so
|
`lib/prelude.fln' writes it as an ordinary struct under a `restart-case', so
|
||||||
nothing in the compiler knows a breakpoint from an error and this buffer is the
|
nothing in the compiler knows a breakpoint from an error and this buffer is the
|
||||||
first place that can tell the difference. Named here rather than spelled at
|
first place that can tell the difference. Named here rather than spelled at
|
||||||
its use, because it is a fact about the prelude.")
|
its use, because it is a fact about the prelude.")
|
||||||
|
|||||||
@ -1528,7 +1528,7 @@ definition, and RET on a frame or on the stop in the break buffer."
|
|||||||
(user-error "flan: the daemon gave %s an unreadable location: %s"
|
(user-error "flan: the daemon gave %s an unreadable location: %s"
|
||||||
subject loc))
|
subject loc))
|
||||||
((string-match-p "\\`<.*>\\'" (nth 0 parts))
|
((string-match-p "\\`<.*>\\'" (nth 0 parts))
|
||||||
;; The prelude is a string inside the compiler (lib/prelude.ml) and
|
;; The prelude is a string inside the compiler (lib/prelude.fln) and
|
||||||
;; names itself <prelude>; anything in angle brackets is a placeholder
|
;; names itself <prelude>; anything in angle brackets is a placeholder
|
||||||
;; the frontend made up, not a path.
|
;; the frontend made up, not a path.
|
||||||
(user-error "flan: %s is defined in %s, which is not a file on disk"
|
(user-error "flan: %s is defined in %s, which is not a file on disk"
|
||||||
|
|||||||
@ -179,7 +179,7 @@ let add (t : t) ~qualify forms =
|
|||||||
adds nothing. *)
|
adds nothing. *)
|
||||||
let table ?file (forms : Form.t list) : t =
|
let table ?file (forms : Form.t list) : t =
|
||||||
let t = create () in
|
let t = create () in
|
||||||
let prelude = try Reader.read_all ~file:Prelude.file Prelude.source with _ -> [] in
|
let prelude = try Prelude.read () with _ -> [] in
|
||||||
add t ~qualify:Fun.id prelude;
|
add t ~qualify:Fun.id prelude;
|
||||||
(match file with
|
(match file with
|
||||||
| None -> ()
|
| None -> ()
|
||||||
|
|||||||
@ -1706,9 +1706,9 @@ let macro_loc tbl name = try Hashtbl.find tbl name with Not_found -> ""
|
|||||||
|
|
||||||
(* The prelude's [defmacro] forms, read once. [Macro.prelude_macros] holds only
|
(* The prelude's [defmacro] forms, read once. [Macro.prelude_macros] holds only
|
||||||
the names and [defs] wants the parameter vectors too, so the forms are kept
|
the names and [defs] wants the parameter vectors too, so the forms are kept
|
||||||
here — and kept lazily for the reason that one is: [Prelude.forms] re-reads
|
here, lazily: [Prelude.forms] reads the prelude once but still rebuilds its
|
||||||
and re-parses the whole prelude on every call, and [defs] is asked on connect
|
forms on every call, and [defs] is asked on connect and again after every
|
||||||
and again after every accepted evaluation. *)
|
accepted evaluation. *)
|
||||||
let prelude_macro_forms =
|
let prelude_macro_forms =
|
||||||
lazy
|
lazy
|
||||||
(List.filter (fun f -> Macro.macro_name f <> None) (Prelude.forms ()))
|
(List.filter (fun f -> Macro.macro_name f <> None) (Prelude.forms ()))
|
||||||
|
|||||||
14
lib/dune
14
lib/dune
@ -64,3 +64,17 @@
|
|||||||
(echo "|c}\n\nlet agent_source = {c|\n")
|
(echo "|c}\n\nlet agent_source = {c|\n")
|
||||||
(cat %{workspace_root}/vendor/agent/flan_agent.c)
|
(cat %{workspace_root}/vendor/agent/flan_agent.c)
|
||||||
(echo "|c}\n")))))
|
(echo "|c}\n")))))
|
||||||
|
|
||||||
|
; The prelude, carried the same way: lib/prelude.fln is the source, read by
|
||||||
|
; the indented reader at every build (lib/prelude.ml). No newline after the
|
||||||
|
; opening quote, so a location's line is the file's line.
|
||||||
|
(rule
|
||||||
|
(target prelude_src.ml)
|
||||||
|
(deps prelude.fln)
|
||||||
|
(action
|
||||||
|
(with-stdout-to
|
||||||
|
prelude_src.ml
|
||||||
|
(progn
|
||||||
|
(echo "let source = {fln|")
|
||||||
|
(cat prelude.fln)
|
||||||
|
(echo "|fln}\n")))))
|
||||||
|
|||||||
2539
lib/prelude.fln
Normal file
2539
lib/prelude.fln
Normal file
File diff suppressed because it is too large
Load Diff
2503
lib/prelude.ml
2503
lib/prelude.ml
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,8 @@
|
|||||||
([Reader]). Both give the same [Form.t], so nothing past this point knows
|
([Reader]). Both give the same [Form.t], so nothing past this point knows
|
||||||
which one a file was written in, and a program may mix them freely.
|
which one a file was written in, and a program may mix them freely.
|
||||||
|
|
||||||
Only program sources come through here. The prelude, the wire protocol and
|
Only program sources come through here. The prelude is indented text
|
||||||
|
embedded in the compiler and read by [Prelude.read]; the wire protocol and
|
||||||
the registry's spellings are paren text the compiler writes itself, and
|
the registry's spellings are paren text the compiler writes itself, and
|
||||||
read it with [Reader] directly. *)
|
read it with [Reader] directly. *)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user