[MLton] can mlbasis rename the top-level?
Matthew Fluet
fluet@cs.cornell.edu
Tue, 6 Sep 2005 16:19:21 -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 would much prefer something like
>
> local
> $(SML_LIB)/basis/basis.mlb
> $(SML_LIB)/smlnj-lib/Util/smlnj-lib.mlb
> in
> sml
> structure IntRedBlackMap = RedBlackMapFn(type ord_key = int
> val compare = Int.compare)
> end
> end
>
> but then you would need to tokenize the SML code and count nested blocks
> (let|local|struct|sig ... end). No need to embed the full grammar, though.
But, you want to be able to map parse/type errors in the embedded SML code
back to the appropriate source location (in the .mlb file). So, you need
to pass the whole of the embedded code (white space included) to the SML
lexer/parser.
I guess you can do it with fancier lexer state games.