Re: [MLton] Implementation of processing ML Basis files

Matthew Fluet <[email protected]> Sun, 20 Jul 2025 08:38:43 -0400
Newsgroups gmane.comp.lang.ml.mlton.devel
Message-ID <CAMrhFL7+5TxuMO8wd1xkSZugA5dpcav6dz57TXoeazt53YQbUg@mail.gmail.com>
--===============7352963056704223227==
Content-Type: multipart/alternative; boundary="000000000000607dd2063a5ba4d3"

--000000000000607dd2063a5ba4d3
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

The amount of work to support MLB files really depends on the
infrastructure around saving and restoring static environments and however
the host compiler represents the program post-type checking.

In MLton, elaboration of MLBs is at:

https://github.com/MLton/mlton/blob/master/mlton/elaborate/elaborate-mlbs.f=
un
It's only 270 lines, but a lot of the interesting aspects come from the
implementation of environments:

https://github.com/MLton/mlton/blob/master/mlton/elaborate/elaborate-env.si=
g

MLton's implementation of environments is rather involved (and with a bit
more mutable state than might be desired); I suspect that supporting MLBs
would be simpler with a purely functional representation of environments.



On Sat, Jul 19, 2025 at 10:54=E2=80=AFAM Gergely Buday via MLton-devel <
[email protected]> wrote:

> Hi there,
>
> I ask this on the devel list as this is about the compiler itself.
>
> I would like to ask you to estimate how much work it would be to port
> MLton's .mlb file support to Poly/ML. I have a student who is willing
> to do it.
>
> I have found the semantics of ML Basis files:
>
> http://mlton.org/MLBasisSyntaxAndSemantics
>
> especially
>
> http://mlton.org/MLBasis.attachments/mlb-formal.pdf
>
> I have found the lexer and grammar files for it, which can be directly
> used:
>
> https://github.com/MLton/mlton/tree/master/mlton/front-end
>
> Where is the part which actually "evaluates" an .mlb file?
>
> And, what do you think, how much work would it be to port it?
>
> The ML Kit also supports ML Basis files, they write their libraries
> with .mlb files. So it would be useful to have this for Poly/ML as
> well.
>
> Yours
>
> - Gergely
>
>
> _______________________________________________
> MLton-devel mailing list
> [email protected]; [email protected]
> https://lists.sourceforge.net/lists/listinfo/mlton-devel
>

--000000000000607dd2063a5ba4d3
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:arial,sa=
ns-serif;font-size:large">The amount of work to support MLB files really de=
pends on the infrastructure around saving and restoring static environments=
 and however the host compiler represents the program post-type checking.</=
div><div class=3D"gmail_default" style=3D"font-family:arial,sans-serif;font=
-size:large"><br></div><div class=3D"gmail_default" style=3D"font-family:ar=
ial,sans-serif;font-size:large">In MLton, elaboration of MLBs is at:</div><=
div class=3D"gmail_default" style=3D"font-family:arial,sans-serif;font-size=
:large">=C2=A0 <a href=3D"https://github.com/MLton/mlton/blob/master/mlton/=
elaborate/elaborate-mlbs.fun">https://github.com/MLton/mlton/blob/master/ml=
ton/elaborate/elaborate-mlbs.fun</a></div><div class=3D"gmail_default" styl=
e=3D"font-family:arial,sans-serif;font-size:large">It&#39;s only 270 lines,=
 but a lot of the interesting aspects come from the implementation of envir=
onments:</div><div class=3D"gmail_default" style=3D"font-family:arial,sans-=
serif;font-size:large">=C2=A0 <a href=3D"https://github.com/MLton/mlton/blo=
b/master/mlton/elaborate/elaborate-env.sig">https://github.com/MLton/mlton/=
blob/master/mlton/elaborate/elaborate-env.sig</a></div><div class=3D"gmail_=
default" style=3D"font-family:arial,sans-serif;font-size:large"><br></div><=
div class=3D"gmail_default" style=3D"font-family:arial,sans-serif;font-size=
:large">MLton&#39;s implementation of environments is rather involved (and =
with a bit more mutable state than might be desired); I suspect that suppor=
ting MLBs would be simpler with a purely functional representation of envir=
onments.</div><div class=3D"gmail_default" style=3D"font-family:arial,sans-=
serif;font-size:large"><br></div><div class=3D"gmail_default" style=3D"font=
-family:arial,sans-serif;font-size:large"><br></div></div><br><div class=3D=
"gmail_quote gmail_quote_container"><div dir=3D"ltr" class=3D"gmail_attr">O=
n Sat, Jul 19, 2025 at 10:54=E2=80=AFAM Gergely Buday via MLton-devel &lt;<=
a href=3D"mailto:[email protected]">[email protected]=
eforge.net</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=
=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding=
-left:1ex">Hi there,<br>
<br>
I ask this on the devel list as this is about the compiler itself.<br>
<br>
I would like to ask you to estimate how much work it would be to port<br>
MLton&#39;s .mlb file support to Poly/ML. I have a student who is willing<b=
r>
to do it.<br>
<br>
I have found the semantics of ML Basis files:<br>
<br>
<a href=3D"http://mlton.org/MLBasisSyntaxAndSemantics" rel=3D"noreferrer" t=
arget=3D"_blank">http://mlton.org/MLBasisSyntaxAndSemantics</a><br>
<br>
especially<br>
<br>
<a href=3D"http://mlton.org/MLBasis.attachments/mlb-formal.pdf" rel=3D"nore=
ferrer" target=3D"_blank">http://mlton.org/MLBasis.attachments/mlb-formal.p=
df</a><br>
<br>
I have found the lexer and grammar files for it, which can be directly used=
:<br>
<br>
<a href=3D"https://github.com/MLton/mlton/tree/master/mlton/front-end" rel=
=3D"noreferrer" target=3D"_blank">https://github.com/MLton/mlton/tree/maste=
r/mlton/front-end</a><br>
<br>
Where is the part which actually &quot;evaluates&quot; an .mlb file?<br>
<br>
And, what do you think, how much work would it be to port it?<br>
<br>
The ML Kit also supports ML Basis files, they write their libraries<br>
with .mlb files. So it would be useful to have this for Poly/ML as<br>
well.<br>
<br>
Yours<br>
<br>
- Gergely<br>
<br>
<br>
_______________________________________________<br>
MLton-devel mailing list<br>
<a href=3D"mailto:[email protected]" target=3D"_blank">MLto=
[email protected]</a>; <a href=3D"mailto:[email protected]"=
 target=3D"_blank">[email protected]</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/mlton-devel" rel=3D=
"noreferrer" target=3D"_blank">https://lists.sourceforge.net/lists/listinfo=
/mlton-devel</a><br>
</blockquote></div>

--000000000000607dd2063a5ba4d3--


--===============7352963056704223227==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============7352963056704223227==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
MLton-devel mailing list
[email protected]; [email protected]
https://lists.sourceforge.net/lists/listinfo/mlton-devel

--===============7352963056704223227==--