summaryrefslogtreecommitdiffstats
path: root/main.sml
diff options
context:
space:
mode:
authorRose Hogenson <rhogenson@posteo.net>2023-02-10 15:06:47 -0800
committerRose Hogenson <rhogenson@posteo.net>2023-02-10 15:06:47 -0800
commitb3f2fd686bc781996687deaadbe721b3300e4aba (patch)
tree7420e4c04fac7ad522a8ee6edc9c2d224958cd87 /main.sml
parentd61fa242bdd71a9f535e65b96ed5407769cc792f (diff)
downloadsml-b3f2fd686bc781996687deaadbe721b3300e4aba.tar.zst
Write a first draft of the compiler.
Sorry I haven't been better about these commit messages. You're not my mom.
Diffstat (limited to 'main.sml')
-rw-r--r--main.sml9
1 files changed, 9 insertions, 0 deletions
diff --git a/main.sml b/main.sml
new file mode 100644
index 0000000..c020691
--- /dev/null
+++ b/main.sml
@@ -0,0 +1,9 @@
+fun parseFiles (filenames : string list) : (string, Syntax.dec list) Either.either =
+ let fun go [] acc = Either.Right (concat (rev acc))
+ | go (f :: fs) acc =
+ case Parser.parse f
+ Either.Right prog => go fs (prog :: acc)
+ err => err
+ in go [] filenames
+
+val _ = parseFiles (CommandLine.arguments ())