Skip to content

Commit

Permalink
Merge pull request #395 from MatthewFluet/smlnj-110.98-libraries
Browse files Browse the repository at this point in the history
Update to SML/NJ 110.98 libraries
  • Loading branch information
MatthewFluet authored Jul 18, 2020
2 parents c1bef0d + c4fc272 commit a267e64
Show file tree
Hide file tree
Showing 13 changed files with 410 additions and 221 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ Here are the changes from version 20180206 to version YYYYMMDD.

=== Details

* 2020-07-18
** Update SML/NJ libraries to SML/NJ 110.98.

* 2020-07-08
** Fix `Real{32,64}_gdtoa` race condition.

Expand Down
4 changes: 2 additions & 2 deletions doc/guide/src/CKitLibrary.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ into abstract syntax represented as a set of SML datatypes. The ckit
Library is distributed with SML/NJ. Due to differences between SML/NJ
and MLton, this library will not work out-of-the box with MLton.

As of 20200626, MLton includes a port of the ckit Library synchronized
with SML/NJ version 110.97.
As of 20200718, MLton includes a port of the ckit Library synchronized
with SML/NJ version 110.98.

== Usage ==

Expand Down
4 changes: 2 additions & 2 deletions doc/guide/src/MLLPTLibrary.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ is a support library for the <:MLULex:> scanner generator and the
<:MLAntlr:> parser generator. The ML-LPT Library is distributed with
SML/NJ.

As of 20200626, MLton includes the ML-LPT Library synchronized with
SML/NJ version 110.87.
As of 20200718, MLton includes the ML-LPT Library synchronized with
SML/NJ version 110.98.

== Usage ==

Expand Down
4 changes: 2 additions & 2 deletions doc/guide/src/MLRISCLibrary.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ ends. The MLRISC Library is distributed with SML/NJ. Due to
differences between SML/NJ and MLton, this library will not work
out-of-the box with MLton.

As of 20200626, MLton includes a port of the MLRISC Library
synchronized with SML/NJ version 110.97.
As of 20200718, MLton includes a port of the MLRISC Library
synchronized with SML/NJ version 110.98.

== Usage ==

Expand Down
4 changes: 2 additions & 2 deletions doc/guide/src/SMLNJLibrary.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ collection of libraries that are distributed with SML/NJ. Due to
differences between SML/NJ and MLton, these libraries will not work
out-of-the box with MLton.

As of 20200626, MLton includes a port of the SML/NJ Library
synchronized with SML/NJ version 110.97.
As of 20200718, MLton includes a port of the SML/NJ Library
synchronized with SML/NJ version 110.98.

== Usage ==

Expand Down
Binary file modified lib/ckit-lib/ckit.tgz
Binary file not shown.
277 changes: 277 additions & 0 deletions lib/mllpt-lib/ml-lpt.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,284 @@
diff --git a/doc/history.tex b/doc/history.tex
index 19be755..8ca8d79 100644
--- a/doc/history.tex
+++ b/doc/history.tex
@@ -6,12 +6,6 @@
Here is a history of changes to the SML/NJ Language Processing Tools.
More details can be found in the SML/NJ \texttt{NOTES} and \texttt{README} files.
\begin{description}
- \item[SML/NJ 110.98]
- \mbox{}\\[0.5em]
- Changed the semantics of the \texttt{--debug} command-line option for \mlantlr{}.
- Previously this option replaced the actions with a print expression, but that
- limited its usefulness because of type errors in the generated code. The new
- behavior is to preserve the existing actions and just add the printing code.
\item[SML/NJ 110.96]
\mbox{}\\[0.5em]
Added the `FilePos` sub-structure to the `AntlrStreamPos` structure. This
diff --git a/doc/manual.tex b/doc/manual.tex
index ec635db..26c0815 100644
--- a/doc/manual.tex
+++ b/doc/manual.tex
@@ -28,7 +28,7 @@
\texttt{adrassi@gmail.com}\\[0.5em]
John Reppy\\
\texttt{jhr@cs.chicago.edu}}
-\date{Revised: May 2020}
+\date{Revised: September 2016}

\newcommand{\Carat}{\^{ }}
\newcommand{\RE}{r}
diff --git a/doc/usage-ml-antlr.tex b/doc/usage-ml-antlr.tex
index 7dab077..0b742ed 100644
--- a/doc/usage-ml-antlr.tex
+++ b/doc/usage-ml-antlr.tex
@@ -47,7 +47,8 @@ where \texttt{file} is the name of the input \ulex{} specification, and where \t
\texttt{--unit-actions} & ignore the action code in the grammar, and instead return \texttt{()}
for every production. \\
\\
- \texttt{--debug} & add code to the actions to print the left-hand-side of the production.
+ \texttt{--debug} & ignore the action code in the grammar, and instead print the
+ left-hand-side of the production.
\end{tabular}%

\vskip 10pt \noindent
diff --git a/lib/mllpt-lib.mlb b/lib/mllpt-lib.mlb
new file mode 100644
index 0000000..0d6bf2a
--- /dev/null
+++ b/lib/mllpt-lib.mlb
@@ -0,0 +1 @@
+ml-lpt-lib.mlb
diff --git a/ml-antlr/BackEnds/SML/sml-output.sml b/ml-antlr/BackEnds/SML/sml-output.sml
index 5501c0b..cd67eb2 100644
--- a/ml-antlr/BackEnds/SML/sml-output.sml
+++ b/ml-antlr/BackEnds/SML/sml-output.sml
@@ -68,7 +68,9 @@ structure SMLOutput =
else
withSuffix @ withSpan @ [fullSpan ^ spanTySuffix] @ refs
in
- String.concat [name, " (", String.concatWith ", " args, ")"]
+ String.concat [name, " (",
+ String.concatWith ", " args,
+ ")"]
end

(* make an expression that will pull the next token off the stream *)
@@ -106,17 +108,15 @@ structure SMLOutput =
fun mkTok (t, strmExp, letFn) =
letFn (ML_App (tokMatch t, [strmExp]))
fun mkNT (nt, strmExp, args, letFn, item) = let
- val name = (case (args, !Options.unitActions)
- of (SOME args, false) => concat [
- "(", NTFnName nt, " (",
- actionHeader (
- "UserCode.ARGS_" ^ Action.name args,
- Item.bindingsLeftOf (item, prod),
- bindingSuffix, true, refcells, rcSuffix),
- "))"
- ]
- | _ => NTFnName nt
- (* end case *))
+ val name = case (args, !Options.actStyle)
+ of (SOME args, Options.ActNormal) =>
+ "(" ^ NTFnName nt ^ " ("
+ ^ actionHeader
+ ("UserCode.ARGS_" ^ Action.name args,
+ Item.bindingsLeftOf (item, prod),
+ bindingSuffix, true, refcells, rcSuffix)
+ ^ "))"
+ | _ => NTFnName nt
val innerExp = ML_App (name, [strmExp])
in
if NT.isSubrule nt
@@ -153,30 +153,29 @@ structure SMLOutput =
| S.OPT nt => mkEBNF (nt, strmExp, "EBNF.optional", mkLet)
end
val itemBindings = Prod.itemBindings prod
- fun debugCode () = concat[
- "print \"", Nonterm.qualName (Prod.lhs prod), "\\n\""
- ]
- val action = if !Options.unitActions
- then "()"
- else (case Prod.action prod
- of SOME _ => actionHeader (
- concat ["UserCode.", Prod.fullName prod, "_ACT"],
- Prod.bindingsAtAction prod, bindingSuffix, false,
- refcells, rcSuffix)
- | NONE => let
- val bindings = ListPair.mapPartial
- (fn (binding, hasValue) =>
- if hasValue
- then SOME (binding ^ bindingSuffix)
- else NONE)
- (itemBindings, Prod.itemYields prod)
- in
- case bindings
- of [] => "()"
- | _ => concat["(", String.concatWith ", " bindings, ")"]
- (* end case *)
- end
- (* end case *))
+ val action =
+ case !Options.actStyle
+ of Options.ActDebug =>
+ "( print \"" ^ (Nonterm.qualName (Prod.lhs prod)) ^ "\\n\" )"
+ | Options.ActUnit => "()"
+ | Options.ActNormal => (case Prod.action prod
+ of SOME _ => actionHeader ("UserCode." ^ Prod.fullName prod ^ "_ACT",
+ Prod.bindingsAtAction prod, bindingSuffix, false,
+ refcells, rcSuffix)
+ | NONE => let
+ val bindings =
+ List.mapPartial
+ (fn (binding, hasValue) =>
+ if hasValue
+ then SOME (binding ^ bindingSuffix)
+ else NONE)
+ (ListPair.zip (itemBindings, Prod.itemYields prod))
+ in
+ if List.length bindings > 0
+ then "(" ^ (String.concatWith ", " bindings) ^ ")"
+ else "()"
+ end
+ (* end case *))
fun innerExp strm = let
val strmVar = ML_Var (strm)
val span = if List.length itemBindings = 0 then
@@ -186,17 +185,9 @@ structure SMLOutput =
ML_Tuple [ML_App ("#1", [ML_Var (hd itemBindings ^ spanSuffix)]),
ML_App ("#2", [ML_Var (hd (rev itemBindings) ^ spanSuffix)])]
val act = ML_Tuple [ML_Raw [ML.Tok action], ML_Var fullSpan, strmVar]
- val act = if !Options.debug
- then ML_Seq[
- ML_Raw[ML.Tok(concat[
- "print \"", Nonterm.qualName (Prod.lhs prod), "\\n\""
- ])],
- act
- ]
- else act
val spanExp = ML_Let (fullSpan, span, act)
- in case (Prod.pred prod, !Options.unitActions)
- of (SOME pred, false) =>
+ in case (Prod.pred prod, !Options.actStyle)
+ of (SOME pred, Options.ActNormal) =>
ML_If (ML_Raw [ML.Tok ("("
^ actionHeader
("UserCode." ^ Prod.fullName prod ^ "_PRED",
@@ -233,20 +224,19 @@ structure SMLOutput =
end

and mkNonterm' (grm, pm) nt = let
- val formals = (case (!Options.unitActions, Nonterm.formals nt)
- of (false, _::_) => concat[
- " (",
- String.concatWithMap ", "
- (fn f => Atom.toString f ^ bindingSuffix)
- (Nonterm.formals nt),
- ")"
- ]
- | _ => ""
- (* end case *))
- val exp = (case Nonterm.prods nt
- of [prod] => mkProd (grm, pm) prod
- | _ => mknProds(grm, pm, nt)
- (* end case *))
+ val formals = case !Options.actStyle
+ of Options.ActNormal =>
+ if length (Nonterm.formals nt) > 0
+ then " (" ^ (String.concatWith ", "
+ (map
+ (fn f => Atom.toString f ^ bindingSuffix)
+ (Nonterm.formals nt)))
+ ^ ")"
+ else ""
+ | _ => ""
+ val exp = if List.length (Nonterm.prods nt) = 1
+ then mkProd (grm, pm) (hd (Nonterm.prods nt))
+ else mknProds(grm, pm, nt)
in
(NTFnName nt ^ formals, ["strm"], exp)
end
diff --git a/ml-antlr/options.sml b/ml-antlr/options.sml
index 6b447ae..ee7289c 100644
--- a/ml-antlr/options.sml
+++ b/ml-antlr/options.sml
@@ -5,21 +5,22 @@
* Processing of command line arguments
*)

-structure Options =
+structure Options =
struct

- val unitActions = ref false
- val debug = ref false
- val dotOutput = ref false
- val texOutput = ref false
- val fname = ref ""
+ datatype action_style = ActNormal | ActUnit | ActDebug
+
+ val actStyle : action_style ref = ref ActNormal
+ val dotOutput : bool ref = ref false
+ val texOutput : bool ref = ref false
+ val fname : string ref = ref ""

(* process the command line arguments; return true if there is an error *)
fun processArgs args = let
fun procArg "--dot" = (dotOutput := true; false)
| procArg "--latex" = (texOutput := true; false)
- | procArg "--unit-actions" = (unitActions := true; false)
- | procArg "--debug" = (debug := true; false)
+ | procArg "--unit-actions" = (actStyle := ActUnit; false)
+ | procArg "--debug" = (actStyle := ActDebug; false)
| procArg _ = true
in
case List.filter procArg args
diff --git a/ml-ulex/FrontEnds/common/lex-spec.sml b/ml-ulex/FrontEnds/common/lex-spec.sml
index b9b4e99..99f9c93 100644
--- a/ml-ulex/FrontEnds/common/lex-spec.sml
+++ b/ml-ulex/FrontEnds/common/lex-spec.sml
@@ -1,6 +1,6 @@
(* lex-spec.sml
*
- * COPYRIGHT (c) 2005
+ * COPYRIGHT (c) 2005
* John Reppy (http://www.cs.uchicago.edu/~jhr)
* Aaron Turon (adrassi@gmail.com)
* All rights reserved.
@@ -8,7 +8,7 @@
* Input specification to ml-ulex
*)

-structure LexSpec =
+structure LexSpec =
struct

datatype clamp = CLAMP127 | CLAMP255 | NO_CLAMP
@@ -52,7 +52,6 @@ structure LexSpec =

fun updHeader (conf, new) = let
val Conf {structName, header, startStates, arg, clamp} = conf
-(* FIXME: we should be reporting an error instead of raising an exception here! *)
val _ = if String.size structName > 0
then raise Fail "Cannot have both %structure and %header"
else ()
@@ -67,7 +66,6 @@ structure LexSpec =

fun updStructName (conf, new) = let
val Conf {structName, header, startStates, arg, clamp} = conf
-(* FIXME: we should be reporting an error instead of raising an exception here! *)
val _ = if String.size header > 0
then raise Fail "Cannot have both %structure and %header"
else ()
@@ -147,8 +145,8 @@ structure LexSpec =
}
fun clearRule (rspec, action) = (rspec, "()")
in Spec {
- decls = "fun eof() = ()\ntype lex_result = unit",
- conf = conf',
+ decls = "fun eof() = ()\ntype lex_result = unit",
+ conf = conf',
rules = List.map clearRule rules,
eofRules = List.map clearRule eofRules
}
Binary file modified lib/mllpt-lib/ml-lpt.tgz
Binary file not shown.
4 changes: 2 additions & 2 deletions lib/mlrisc-lib/MLRISC.patch
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,7 @@ index c6c1eb8..7c0069d 100644
struct

diff --git a/amd64/mltree/amd64-gen.sml b/amd64/mltree/amd64-gen.sml
index 7543483..982dae3 100644
index 2255bcc..1d56946 100644
--- a/amd64/mltree/amd64-gen.sml
+++ b/amd64/mltree/amd64-gen.sml
@@ -9,10 +9,53 @@
Expand Down Expand Up @@ -18147,7 +18147,7 @@ index 60a8610..43977b8 100644
-
-end (* local *)
diff --git a/x86/mltree/x86.sml b/x86/mltree/x86.sml
index b6975c1..3388337 100644
index 16c7103..050be4a 100644
--- a/x86/mltree/x86.sml
+++ b/x86/mltree/x86.sml
@@ -32,19 +32,77 @@
Expand Down
Binary file modified lib/mlrisc-lib/MLRISC.tgz
Binary file not shown.
Loading

0 comments on commit a267e64

Please sign in to comment.