[MLton-user] bug with path variables in mlb files

Matthew Fluet fluet at tti-c.org
Tue Nov 6 06:42:23 PST 2007


On Tue, 6 Nov 2007, Vesa Karvonen wrote:
> I took the liberty of fixing this by allowing digits in path variables:
>
>  http://mlton.org/pipermail/mlton-commit/2007-November/002129.html
>
> So, just svn up, rebuild, install the compiler, and the problem disappears.
>
> -Vesa Karvonen
>
> On Nov 6, 2007 1:36 PM, John Reppy <jhr at cs.uchicago.edu> wrote:
>> It appears that a path variable like $(SML3D_LIB) is not considered a
>> valid token by mlton. [...]

I don't think there was ever a reason to disallow digits in path 
variables.  I don't know that additional symbols would be desirable, 
though I guess one could make the claim for them.  Vesa's patch makes the 
lexical conventions for MLBasis files:

pathvar="$("([A-Z_][A-Z0-9_]*)")";
filebase=({pathvar}|[-A-Za-z_0-9])+;
fileext=({pathvar}|[-A-Za-z_0-9])+;
filename={filebase}("."{fileext})*;
arc=({pathvar}|{filename}|"."|"..");
relpath=({arc}"/")*;
abspath="/"{relpath};
path={relpath}|{abspath};
file={path}{filename};

That falls short of the full range of UNIX paths (since we rule out most 
special characters).  But, one can also use put file names in " (quotes) 
for an arbitrary file name, in which case they are lexed as SML string 
constants.



More information about the MLton-user mailing list