[MLton] can mlbasis rename the top-level?

Stephen Weeks MLton@mlton.org
Tue, 6 Sep 2005 13:56:05 -0700


> > 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.

You could skip the SML lexer and pass the token stream (with file
positions) directly to the SML parser.  But this would require
combining the SML and MLB lexers, already a big step.  For the first
whack, a minimal modification of the MLB lexer seems the way to go.
I'm OK with {<{ and }>}, but I wouldn't be surprised to hear a better
proposal.

I'd like to see us moving toward no delimiters being needed at all,
simply having the production

  <basdec> --> <program>

But I realize that's a ways off, if ever.  A simple hack like

  <basdec> --> "{<{" <program> "}>}"

goes a long way.


Hmmm.  Combining Vesa's suggestion with the requirement for having the
MLB lexer handle things, what about:

  <basdec> --> "_sml" <program> "_end"

Actually, we could even do

  <basdec> --> "sml" <program> "_end"

since all that matters is being able to pick out "_end".