You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The hardest to make in a compiler is perhaps make it incremental (Pay-As-You-Go style ---- so subsequent builds only analyse dirty areas), error-tolerant, reusable (say a "Basic" family that may be modded for specific applications), algebraicly-typed ("Let xs = [] in ( xs := 1::xs ; we got xs : real list ; ... ) end") and well-localized. Stablishing a new compiler is, therefore, non-trivial.
I've been starting a technology to tackle on these obstacles since july, starting by settling up with its reference documents, with the only purpose of facilitating compiler creation. I initially made the first drafts publicly viewable (where I perhaps used a Pythonic-Lua DSL), but then evolved it with a "MLgate" DSL. Given the amount of dedication (even if only into the referential documents), it is going to be closed-source until I decide how it is worthy releasing it. Its roadmap consists of integrating a few paper ideas (some involving the dependable build tooling that engineers can create with it) and concluding the bootstrap implementation (which I am now beginning with Deno ---- Rusty turned irrelevant to me).
This thread is not going to propose any solution for now, yet. I will share little peeks per the reference (which does cover a lot more than that already).
Tree traversal
Tree traversal --- entering a node and its subnodes recursively for processing --- occurs within the following kinds of snippet.
(* n : Tree *)
(* master sample *)
fun f () = List.app (fn n' => ...) (n->children())
val _ = List.filter (fn n' => yesno) (n->children())
val _ = List.exists (fn n' => yesno) (n->children())
val _ = List.all (fn n' => yesno) (n->children())
val _ = with n' do ... end
The following snippet is a combo of the regular child nodes and comment attachments.
val _ = (n->children()) @ (n->comments())
The following snippet is a combo of the regular child nodes and IncludeGates.
val _ = (n->children()) @ (n->includeGates())
Each node queries their surrounding frame from themselves (+final::blockFrame) or through former siblings (+final::shadowFrame) and up-levels.
[...]
Fundamental properties
Of the fundamental properties, I am going to share what we are generally gonna attach to r : Tree (the "nodes" or "rulesets") during verification.
[begin:table by column]
**Snippet**
1. `r->+final::val`
2. `r->+final::binding`
3. `r->+final::reference`
4. `r->+final::target`
5. `r->+final::blockFrame`
6. `r->+final::shadowFrame`
7. `r->+final::promoteFrame`
8. `r->+final::parameter`
**Description**
1. *The value* resulting from resolving an expression
2. A binding (variable, function or type) originating from a construct
3. An input reference for reading[^1]
4. An output reference for writing[^1]
5. A scope that should be entered and exited during tree traversal.
This does not apply just to block-like statements, but also to expression bodies.
6. Used for nodes inside a list during tree traversal, that is a
*shadowing* scope that should be entered and exited for as long as the end of that list.
7. A frame that should be manually promoted to some other node.
8. A matching parameter binding --- assigning this is recommended
for an invocation's arguments.
[end:table]
[^1]: Used instead of `+final::val` when that causes confusion
Lazyness & implicit contexts
MLgate should designate as lazy by default only certain methods. Those which are not lazy still register triggers as part of the surrounding lazy method in the stack frame. For instance,
fun verify! ctx =
let val f = ceng->frame () in
let
val f' = f->lookup { key = String "x", ... }
handle NotFound e >= ...
handle AmbiguousReference e => ...
in
...
end
end
ceng->frame () queries the surrounding frame of the node being currently processed (e.g. traversed, verified or evaluated (codegen)). For that verification routine a least trigger should be registered around the current node for when the name x overgoes an update.
The above routine takes a ctx --- note that everything takes an implicit bigger context in MLgate, but verification passes do need further context for footprint and requirements like the context type, weakType and invokee.
Deferring and lazyness re-evaluations is where one gets cheap support for "Algebraic Typing" where you can omit type hints freely.
In addition, the anything MLgate type is (de)serializable around an internal format, since lazyness stores cache in-storage.
Doc comments
As to ActionScript 3 style comments, we got room in.
<mode(normal)>
<token(comment)>
ruleset Comment ::= ... class
fun commentOut! () do
ceng->comment (forward or line) ;
(* "this stack of comments is documenting"
the respective item. *)
ceng->comment ( sub (eqv, YUIDocComment), forward or line ) ;
end
end
<doc>
<mode(comment)>
ruleset YUIDocComment ::= class
ceng->docComment (
tag ( prefix("@") ruleset(YUIDocTag) )
markup = mm
forms ( stars, rowing )
star = "*"
)
end
<doc>
<mode(tag)>
ruleset YUIDocTag >>>=
| YUIDocTag.Throws
class
<doc>
<mode(tag)>
ruleset Throws ::=
"throws" e:ClassName desc:mm.Text?
;
end
Well, share no more.
I have written lots of organised information, like rulesets for parsing, C-like preprocessing, include capabilities (like Rust's include!()) and lots of details I will not explore on this topic. I just wanted to talk a bit :v
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
The hardest to make in a compiler is perhaps make it incremental (Pay-As-You-Go style ---- so subsequent builds only analyse dirty areas), error-tolerant, reusable (say a "Basic" family that may be modded for specific applications), algebraicly-typed ("Let xs = [] in ( xs := 1::xs ; we got xs : real list ; ... ) end") and well-localized. Stablishing a new compiler is, therefore, non-trivial.
I've been starting a technology to tackle on these obstacles since july, starting by settling up with its reference documents, with the only purpose of facilitating compiler creation. I initially made the first drafts publicly viewable (where I perhaps used a Pythonic-Lua DSL), but then evolved it with a "MLgate" DSL. Given the amount of dedication (even if only into the referential documents), it is going to be closed-source until I decide how it is worthy releasing it. Its roadmap consists of integrating a few paper ideas (some involving the dependable build tooling that engineers can create with it) and concluding the bootstrap implementation (which I am now beginning with Deno ---- Rusty turned irrelevant to me).
This thread is not going to propose any solution for now, yet. I will share little peeks per the reference (which does cover a lot more than that already).
Tree traversal
Tree traversal --- entering a node and its subnodes recursively for processing --- occurs within the following kinds of snippet.
The following snippet is a combo of the regular child nodes and comment attachments.
The following snippet is a combo of the regular child nodes and
IncludeGates.Each node queries their surrounding frame from themselves (
+final::blockFrame) or through former siblings (+final::shadowFrame) and up-levels.[...]
Fundamental properties
Of the fundamental properties, I am going to share what we are generally gonna attach to
r : Tree(the "nodes" or "rulesets") during verification.Lazyness & implicit contexts
MLgate should designate as lazy by default only certain methods. Those which are not lazy still register triggers as part of the surrounding lazy method in the stack frame. For instance,
ceng->frame ()queries the surrounding frame of the node being currently processed (e.g. traversed, verified or evaluated (codegen)). For that verification routine a least trigger should be registered around the current node for when the namexovergoes an update.The above routine takes a
ctx--- note that everything takes an implicit bigger context in MLgate, but verification passes do need further context for footprint and requirements like the contexttype,weakTypeandinvokee.Deferring and lazyness re-evaluations is where one gets cheap support for "Algebraic Typing" where you can omit type hints freely.
In addition, the
anythingMLgate type is (de)serializable around an internal format, since lazyness stores cache in-storage.Doc comments
As to ActionScript 3 style comments, we got room in.
Well, share no more.
I have written lots of organised information, like rulesets for parsing, C-like preprocessing, include capabilities (like Rust's
include!()) and lots of details I will not explore on this topic. I just wanted to talk a bit :vAll reactions