[MLton] can mlbasis rename the top-level?
Matthew Fluet
fluet@cs.cornell.edu
Tue, 6 Sep 2005 16:09:36 -0400 (EDT)
>> I like the idea of delimiting the the sml in a manner that doesn't
>> require embedding the SML grammar in the MLB grammar.
>
> I can see that this is much easier from an implementation perspective,
> but I wonder if you have other reasons?
Not really. Note that implementation wise, it's even more difficult to
embedd than it appears at first glance: we've added "basis" and "bas" as
keywords in the MLB grammar, but they are not keywords in SML, so parsing
needs to keep some sort of state as to whether it is in embedded SML or in
the MLB grammar to determine the parse of the BASIS and BAS tokens.
>> I imagine something like the above could be handled by the lexer,
>> yielding a (big) string token, which could be pushed through the SML
>> lexer/parser rather than a file name.
>
> This does seem easy. It requires that the MLB lexer handle SML
> comments so that one doesn't accidentally close the SML code from
> within a comment. And it requires that we choose a closing character
> sequence that could not occur in SML. "}}}" doesn't work. How about
> "___" or "_sml"?
This is where I feel that "completely arbitrary" SML in MLB files is above
and beyond the call of duty. I forsee it being useful for quick items
(like functor applications, renaming Core level bindings) and that it
shouldn't be used for large amounts of code. I know there is an argument
for having self-contained scripts.
In any case, I don't find "___" or "_sml" to be compelling. I prefer
something that visually delimits. I don't believe that "{<{" "}>}" can
occur in a well-formed SML program.