[MLton] implement _address and _symbol
Wesley W. Terpstra
wesley@terpstra.ca
Sun, 17 Jul 2005 22:55:10 +0200
On Sun, Jul 17, 2005 at 12:57:50PM -0700, Stephen Weeks wrote:
> While I'm soliciting help, Wesley, do you have any interest in
> implementing _address and _symbol?
I can try; I am a bit daunted by the task, though.
As you are aware, I am not a compiler developer...
There's a reason all of my changes are basis or runtime related.
You'll notice that in every other case, I phrased it as a bug and
sent it to the list in the hopes someone smarter could do it. ;-)
> MLton already has the Pointer_{get,set} primitives, so the only
> additional thing needed is a primitive to support _address.
I'm not too clear what exactly a primitive is.
Shouldn't there already be one if _import # exists?
So, let me see if my very general understanding of MLton is right:
it parses the source into an AST
it does some kind of scoped binding of names to values
it type checks and associates types with the values
it rewrite the whole thing into successively simpler languages
finally, there is a language so simple that it is only calls to
'primitives'
this gets run through the codegen
If the above is right, then what I need to do is add _address and _symbol as
keywords to the parser, teach the type checker how to resolve the type of
these things using the '_symbol "s": type;' syntax, during one of those
intermediate language steps convert it to a pair of functions that call
Pointer_{get,set}.
For _address, I probably just need to move whatever _import # did to it.
> That and a little bit of front end hacking to expand the syntax into the
> appropriate lambda expressions should do it.
Is the front-end one of the language simplification steps?
(Perhaps the first one?)
--
Wesley W. Terpstra <wesley@terpstra.ca>