Skip to content

Commit

Permalink
Revert unnecessary white-space changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewFluet committed Aug 18, 2018
1 parent e7dbefb commit 5d36991
Show file tree
Hide file tree
Showing 11 changed files with 165 additions and 171 deletions.
5 changes: 1 addition & 4 deletions lib/mlton/basic/parse.sig
Expand Up @@ -23,7 +23,7 @@ signature PARSE =
(*
* infix 1 <|> >>=
* infix 3 <*> <* *>
* infixr 4 <$> <$$> <$$$> <$$$$> <$ <$?>
* infixr 4 <$> <$$> <$$$> <$$$$> <$ <$?>
*)
val >>= : 'a t * ('a -> 'b t) -> 'b t
val <*> : ('a -> 'b) t * 'a t -> 'b t
Expand Down Expand Up @@ -96,9 +96,6 @@ signature PARSE =
val notFollowedBy: 'a t * 'b t -> 'a t
(* succeeds with SOME if the parser succeeded and NONE otherwise *)
val optional: 'a t -> 'a option t

(*val optionalWN: 'a t -> 'a t*)

(* parse an integer, as Integer.scan StringCVT.DEC *)
val int: int t
val intInf: IntInf.t t
Expand Down
4 changes: 1 addition & 3 deletions lib/mlton/basic/parse.sml
Expand Up @@ -9,7 +9,7 @@ struct

infix 1 <|> >>=
infix 3 <*> <* *>
infixr 4 <$> <$$> <$$$> <$$$$> <$ <$?>
infixr 4 <$> <$$> <$$$> <$$$$> <$ <$?>

structure Location =
struct
Expand Down Expand Up @@ -215,8 +215,6 @@ fun sepBy(t, sep) = uncut ((op ::) <$$> (t, many' (sep *> t)) <|> pure [])

fun optional t = SOME <$> t <|> pure NONE

(*fun optionalWN t = SOME <$> t <|> NONE <$> t*)

fun char c s = case Stream.force (s)
of NONE => Failure [String.fromChar c ^ " at end of file"]
| SOME((h, _), r) =>
Expand Down
26 changes: 13 additions & 13 deletions mlton/main/compile.fun
Expand Up @@ -40,7 +40,7 @@ structure CoreML = CoreML (open Atoms
expandOpaque = true,
var = var}

fun layout t =
fun layout t =
#1 (layoutPretty
(t, {expandOpaque = true,
layoutPrettyTycon = Tycon.layout,
Expand Down Expand Up @@ -118,7 +118,7 @@ fun setCommandLineConstant (c as {name, value}) =
set
end
val () =
case List.peek ([("Exn.keepHistory",
case List.peek ([("Exn.keepHistory",
make (Bool.fromString, Control.exnHistory))],
fn (s, _) => s = name) of
NONE => ()
Expand Down Expand Up @@ -158,7 +158,7 @@ val lookupConstant =
fn z => f () z
end

(* ------------------------------------------------- *)
(* ------------------------------------------------- *)
(* Primitive Env *)
(* ------------------------------------------------- *)

Expand Down Expand Up @@ -216,7 +216,7 @@ local

structure Env =
struct
open Env
open Env

structure Tycon =
struct
Expand Down Expand Up @@ -329,7 +329,7 @@ structure MLBString:>

val lexAndParseMLB = MLBString.lexAndParseMLB

val lexAndParseMLB: MLBString.t -> Ast.Basdec.t =
val lexAndParseMLB: MLBString.t -> Ast.Basdec.t =
fn input =>
let
val ast = lexAndParseMLB input
Expand Down Expand Up @@ -411,7 +411,7 @@ fun elaborate {input: MLBString.t}: Xml.Program.t =
val _ =
case !Control.exportHeader of
NONE => ()
| SOME f =>
| SOME f =>
File.withOut
(f, fn out =>
let
Expand All @@ -436,11 +436,11 @@ fun elaborate {input: MLBString.t}: Xml.Program.t =
| Control.Executable => "PART_OF"
| Control.LibArchive => "NO_DEFAULT_LINK"
| Control.Library => "DYNAMIC_LINK"
val _ =
val _ =
print ("#if !defined(PART_OF_" ^ libcap ^ ") && \\\n\
\ !defined(STATIC_LINK_" ^ libcap ^ ") && \\\n\
\ !defined(DYNAMIC_LINK_" ^ libcap ^ ")\n")
val _ =
val _ =
print ("#define " ^ defaultLinkage ^ "_" ^ libcap ^ "\n")
val _ = print "#endif\n"
val _ = print "\n"
Expand All @@ -463,11 +463,11 @@ fun elaborate {input: MLBString.t}: Xml.Program.t =
val _ = print "extern \"C\" {\n"
val _ = print "#endif\n"
val _ = print "\n"
val _ =
val _ =
if !Control.format = Control.Executable then () else
(print ("MLLIB_PUBLIC(void " ^ libname ^ "_open(int argc, const char** argv);)\n")
;print ("MLLIB_PUBLIC(void " ^ libname ^ "_close();)\n"))
val _ = Ffi.declareHeaders {print = print}
val _ = Ffi.declareHeaders {print = print}
val _ = print "\n"
val _ = print "#undef MLLIB_PRIVATE\n"
val _ = print "#undef MLLIB_PUBLIC\n"
Expand Down Expand Up @@ -674,7 +674,7 @@ fun makeMachine ssa2 =
machine
end

fun setupConstants() : unit =
fun setupConstants() : unit =
(* Set GC_state offsets and sizes. *)
let
val _ =
Expand Down Expand Up @@ -846,7 +846,7 @@ fun genFromSXML (input: File.t): Machine.Program.t =
thunk = (fn () => case
Parse.parseFile(ParseSxml.program, input)
of Result.Yes x => x
| Result.No msg => (Control.error
| Result.No msg => (Control.error
(Region.bogus, Layout.str "Sxml Parse failed", Layout.str msg);
Control.checkForErrors("parse");
(* can't be reached *)
Expand Down Expand Up @@ -881,7 +881,7 @@ fun genFromSsa (input: File.t): Machine.Program.t =
thunk = (fn () => case
Parse.parseFile(ParseSsa.program, input)
of Result.Yes x => x
| Result.No msg => (Control.error
| Result.No msg => (Control.error
(Region.bogus, Layout.str "Ssa Parse failed", Layout.str msg);
Control.checkForErrors("parse");
(* can't be reached *)
Expand Down
1 change: 0 additions & 1 deletion mlton/main/compile.sig
Expand Up @@ -54,7 +54,6 @@ signature COMPILE =
outputS: unit -> {file: File.t,
print: string -> unit,
done: unit -> unit}} -> unit

val compileSSA2: {input: File.t,
outputC: unit -> {file: File.t,
print: string -> unit,
Expand Down
1 change: 0 additions & 1 deletion mlton/main/main.fun
Expand Up @@ -1601,7 +1601,6 @@ fun commandLine (args: string list): unit =
mkCompileSrc {listFiles = fn {input} => Vector.new1 input,
elaborate = fn _ => raise Fail "Unimplemented",
compile = Compile.compileSSA}

val compileSSA2 =
mkCompileSrc {listFiles = fn {input} => Vector.new1 input,
elaborate = fn _ => raise Fail "Unimplemented",
Expand Down
58 changes: 29 additions & 29 deletions mlton/ssa/parse-ssa.fun
Expand Up @@ -12,7 +12,7 @@ struct
open P.Ops
infix 1 <|> >>=
infix 3 <*> <* *>
infixr 4 <$> <$$> <$$$> <$$$$> <$ <$?>
infixr 4 <$> <$$> <$$$> <$$$$> <$ <$?>

fun isInfixChar b = case List.index
(String.explode "!%&$#+-/:<=>?@\\~'^|*",
Expand Down Expand Up @@ -82,7 +82,7 @@ struct


(* too many arguments for the maps, curried to use <*> instead *)
fun makeTyp resolveTycon (args, ident) =
fun makeTyp resolveTycon (args, ident) =
case ident of
"array" => Type.array (Vector.first args)
| "intInf" => Type.intInf
Expand Down Expand Up @@ -166,9 +166,9 @@ struct

(* Prim EXP *)


fun primAppExp resolveTycon resolveVar =
let
fun primAppExp resolveTycon resolveVar =
let
val var = resolveVar <$> ident <* P.spaces

val varExp =
Expand Down Expand Up @@ -199,7 +199,7 @@ struct
[CFunction.SymbolScope.External <$ token "external",
CFunction.SymbolScope.Private <$ token "private",
CFunction.SymbolScope.Public <$ token "public"]


val parseTarget = CFunction.Target.Indirect <$ symbol "<*>" <|>
CFunction.Target.Direct <$> ident
Expand Down Expand Up @@ -227,7 +227,7 @@ struct
<*> fromRecord "symbolScope" parseSymbolScope
<* doneRecord)

fun resolvePrim p =
fun resolvePrim p =
case Prim.fromString p
of SOME p' => P.pure p'
| NONE => P.fail ("valid primitive, got " ^ p)
Expand All @@ -244,7 +244,7 @@ struct
P.spaces *> P.tuple varExp <* P.spaces))
end

fun makeStatement (var, ty, exp) =
fun makeStatement (var, ty, exp) =
Statement.T
{var = var,
ty = ty,
Expand All @@ -262,7 +262,7 @@ struct
(SOME <$> var <|> token "_" *> P.pure(NONE),
symbol ":" *> (typ resolveTycon) <* P.spaces)
fun makeConApp(con, args) = { con=con, args=args }
fun conApp v =
fun conApp v =
makeConApp <$$>
(resolveCon <$> ident <* P.spaces,
v)
Expand All @@ -274,14 +274,14 @@ struct
| Type.Real rs => Const.Real <$> parseReal rs <|> P.failCut "real"
| Type.IntInf => Const.IntInf <$> parseIntInf <|> P.failCut "integer"
| Type.CPointer => Const.null <$ token "NULL" <|> P.failCut "null"
| Type.Vector _ =>
| Type.Vector _ =>
(* assume it's a word8 vector *)
P.any
[Const.string <$> parseString,
Const.wordVector <$> parseWord8Vector,
P.failCut "string constant"]
| _ => P.fail "constant"

fun makeSelect(offset, var) = {offset=offset, tuple=var}
val selectExp = symbol "#" *> P.cut(makeSelect <$$>
(P.uint <* P.spaces,
Expand All @@ -302,14 +302,14 @@ struct
makeStatement
<$>
(typedvar >>= (fn (var, ty) =>
(symbol "=" *> exp ty <* P.spaces) >>= (fn exp =>
(symbol "=" *> exp ty <* P.spaces) >>= (fn exp =>
P.pure (var, ty, exp))))
in
statement'
end



fun globls resolveCon resolveTycon resolveVar =
fun globls resolveCon resolveTycon resolveVar =
let
fun globals' () = P.spaces *> token "Globals:" *> Vector.fromList <$>
P.many (statements resolveCon resolveTycon resolveVar)
Expand All @@ -318,7 +318,7 @@ struct
end

fun makeFunction name args returns raises label blocks =
Function.new
Function.new
{args = args,
blocks = blocks,
mayInline = false,
Expand All @@ -328,8 +328,8 @@ struct
start = label}


fun functns resolveCon resolveTycon resolveVar resolveFunc resolveLabel =
let
fun functns resolveCon resolveTycon resolveVar resolveFunc resolveLabel =
let
val name = P.spaces *> symbol "fun" *> resolveFunc <$> ident <*
P.spaces

Expand Down Expand Up @@ -391,13 +391,13 @@ struct
)))

val transferCase = Transfer.Case <$> casesExp

fun makeGoto dst args =
fun makeGoto dst args =
Transfer.Goto {dst = dst, args = args}

val transferGoto = makeGoto
<$> labelWithArgs
<*> vars
<*> vars

fun makeArith (ty, success, {prim, targs = _, args}, overflow) =
Transfer.Arith {
Expand All @@ -414,7 +414,7 @@ struct
")",
P.spaces *> P.str "handle Overflow => " *> label' <* P.spaces)

fun makeReturnNonTail cont (handler) =
fun makeReturnNonTail cont (handler) =
Return.NonTail {
cont=cont,
handler=
Expand All @@ -427,7 +427,7 @@ struct
fun returnNonTail cont = makeReturnNonTail cont <$>
(P.str "handle _ => " *> ident <* P.spaces)

fun getReturn return =
fun getReturn return =
case return of
"dead" => P.pure(Return.Dead)
| "return" => P.pure(Return.Tail)
Expand All @@ -438,10 +438,10 @@ struct
Transfer.Call {
args=args,
func=func,
return=return
return=return
}

val transferCall =
val transferCall =
P.spaces *> P.str "call" *> P.spaces *> ident <* P.spaces >>= (fn return =>
symbol "(" *> resolveFunc <$> ident <* P.spaces >>= (fn func =>
vars <* symbol ")" <* P.spaces >>= (fn argus =>
Expand Down Expand Up @@ -475,7 +475,7 @@ struct
[transferArith, transferCase, transferCall, transferBug,
transferRuntime, transferRaise, transferReturn, transferGoto]

fun makeBlock label args statements transfer =
fun makeBlock label args statements transfer =
Block.T {
args = args,
label = label,
Expand Down Expand Up @@ -510,8 +510,8 @@ struct
{datatypes = datatypes,
functions = functions,
globals = globals,
main = main}

main = main}
val program : Program.t Parse.t =
let
fun strip_unique s = case P.parseString
Expand All @@ -526,7 +526,7 @@ struct
SOME con => con
| NONE => resolveCon0 ident
val resolveTycon0 = makeNameResolver(Tycon.newString o strip_unique)
fun resolveTycon ident =
fun resolveTycon ident =
case ident of
"bool" => Tycon.bool
| "exn" => Tycon.exn
Expand All @@ -546,5 +546,5 @@ struct
(* failing next to check for end of file *)
<* P.spaces <* (P.failing P.next <|> P.failCut "End of file"))))
end

end

0 comments on commit 5d36991

Please sign in to comment.