diff --git a/Compiler.hs b/Compiler.hs
new file mode 100644
--- /dev/null
+++ b/Compiler.hs
@@ -0,0 +1,25 @@
+import qualified NXT.AttoParser as P
+import NXT.Types
+import NXT.Inference
+
+import System.Environment
+
+main =
+    do args <- getArgs
+       case args of
+         [filename] -> parseFile filename
+         _ -> putStrLn "USAGE: ./Compiler [filename]"
+
+parseFile f =
+    do pResult <- P.parseFile f
+       case pResult of
+         Left errorMsg ->
+             putStrLn $ "Error: " ++ errorMsg
+         Right funDefs ->
+             do inferredDefs <- runInference funDefs
+                let cComment = "/* Generated by legoDSL. Don't touch! */"
+                    cHeader = concatMap (prettyFD' False) inferredDefs
+                    cCode = concatMap prettyFD inferredDefs
+                    outFile = f ++ ".nxc"
+                writeFile outFile $ (cComment ++ cHeader ++ cCode)
+                putStrLn $ "Compiling ok. Generated " ++ outFile
diff --git a/NXTDSL.cabal b/NXTDSL.cabal
--- a/NXTDSL.cabal
+++ b/NXTDSL.cabal
@@ -1,5 +1,5 @@
 Name:                NXTDSL
-Version:             0.2
+Version:             0.3
 Synopsis:            Generate NXC Code from DSL
 Description:         Typesafe code generation for the LEGO-NXT
 License:             BSD3
@@ -14,7 +14,7 @@
 Bug-reports:            https://github.com/agrafix/legoDSL/issues
 
 Library
-   Build-Depends:     base >= 3 && < 5, mtl, unordered-containers, resourcet >= 0.4.4, stm >= 2.4.2, text, uu-parsinglib >= 2.7.4
+   Build-Depends:     base >= 3 && < 5, mtl, unordered-containers, resourcet >= 0.4.4, stm >= 2.4.2, text, attoparsec >= 0.10.4.0, hashable >= 1.2.0.5
    Exposed-modules:   NXT.Core, NXT.Interpretation, NXT.Common, NXT.Motor, NXT.Sensor
 
 Executable ExampleRun
@@ -24,8 +24,8 @@
    Main-Is: ExampleVM.hs
    ghc-options:       -threaded
 
-Executable Parser
-   Main-Is: Parser.hs
+Executable Compiler
+   Main-Is: Compiler.hs
 
 Source-repository head
    Type:                 git
diff --git a/Parser.hs b/Parser.hs
deleted file mode 100644
--- a/Parser.hs
+++ /dev/null
@@ -1,14 +0,0 @@
-import NXT.Parser
-import NXT.Types
-
-import System.Environment
-
-main =
-    do args <- getArgs
-       case args of
-         [filename] -> parseFile filename
-         _ -> putStrLn "USAGE: ./Parser [filename]"
-
-parseFile f =
-    do r <- runFile pProg f
-       mapM_ (\v -> putStrLn (prettyFD v)) r
