diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,30 @@
+Copyright (c) 2012, José Lopes
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above
+      copyright notice, this list of conditions and the following
+      disclaimer in the documentation and/or other materials provided
+      with the distribution.
+
+    * Neither the name of José Lopes nor the names of other
+      contributors may be used to endorse or promote products derived
+      from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/doc/examples/example b/doc/examples/example
new file mode 100644
--- /dev/null
+++ b/doc/examples/example
@@ -0,0 +1,23 @@
+My first Fmark document [with style]
+José Lopes
+Sunday, Sep 4 2012
+
+  Fmark (Friendly Markup) is a very simple markup language without
+  syntax, capable of producing PDF and XML files, and very simple
+  document but sophisticated styling.
+
+The first section
+
+Hello, welcome to Fmark.
+This is the first section of your document.
+
+  The first subsection
+
+  It is very simple to create subsections. No special characters are
+  needed. Simply use indentation to indicate the beginning and end of
+  your sections.
+
+  The second subsection
+
+  Another subsection with a different title and a [footnote in square
+  bracket]. Again very simple.
diff --git a/doc/examples/example.pdf b/doc/examples/example.pdf
new file mode 100644
Binary files /dev/null and b/doc/examples/example.pdf differ
diff --git a/doc/examples/example.style b/doc/examples/example.style
new file mode 100644
--- /dev/null
+++ b/doc/examples/example.style
@@ -0,0 +1,5 @@
+Title [Subtitle]
+Author
+Date
+
+  Abstract.
diff --git a/doc/examples/exampleNoStyle.pdf b/doc/examples/exampleNoStyle.pdf
new file mode 100644
Binary files /dev/null and b/doc/examples/exampleNoStyle.pdf differ
diff --git a/fmark.cabal b/fmark.cabal
new file mode 100644
--- /dev/null
+++ b/fmark.cabal
@@ -0,0 +1,40 @@
+name:                fmark
+version:             0.1.0
+homepage:            http://github.com/jabolopes/fmark
+bug-reports:         http://github.com/jabolopes/fmark/issues
+synopsis:            A Friendly Markup language without syntax.
+description:         Fmark (Friendly Markup) is a very simple markup language without
+                     syntax and simple but sophisticated document styling, capable of
+                     producing PDF and XML files.
+license:             BSD3
+license-file:        LICENSE
+author:              José Lopes
+maintainer:          José Lopes <jabolopes@gmail.com>
+stability:           Experimental
+category:            Typography
+
+build-type:          Simple
+cabal-version:       >=1.8
+
+data-files:
+  doc/examples/example
+  doc/examples/example.pdf
+  doc/examples/example.style
+  doc/examples/exampleNoStyle.pdf
+
+executable fmark
+  main-is:             Main.hs
+  extensions:	       DoAndIfThenElse
+  hs-source-dirs:      src
+  -- other-modules:       
+  build-depends:
+        base == 4.5.*,
+        mtl == 2.1.*,
+        directory == 1.1.*,
+        filepath == 1.3.*,
+        process == 1.1.*,
+        Unixutils == 1.50.*
+
+source-repository head
+  type:     git
+  location: http://github.com/jabolopes/fmark.git
diff --git a/src/Main.hs b/src/Main.hs
new file mode 100644
--- /dev/null
+++ b/src/Main.hs
@@ -0,0 +1,61 @@
+module Main where
+
+import Data.List (intercalate, dropWhileEnd)
+
+import System.Console.GetOpt
+import System.Environment (getArgs, getProgName)
+import System.IO
+
+
+import Fmark
+
+
+-- | 'options' represents the command line options.
+options = [Option "d" ["doc"] (NoArg OutputDoc) "Output doc",
+           Option "l" ["latex"] (NoArg OutputLatex) "Output latex",
+           Option "p" ["pdf"] (NoArg OutputPdf) "Output PDF",
+           Option "s" ["style"] (ReqArg StyleName "style-name") "Style",
+           Option "x" ["xml"] (NoArg OutputXml) "Output xml",
+           Option [] ["help"] (NoArg Help) "Display help"]
+
+
+-- | 'main'.
+main =
+    do args <- getArgs
+       case getOpt Permute options args of
+         (opts, nonOpts, []) -> processOpts opts nonOpts
+         (_, _, errs) -> do putErrors errs
+                            putUsage
+    where header progName = "Usage: " ++ progName ++ " [OPTION...] files..."
+
+          putUsage =
+              do progName <- getProgName
+                 hPutStr stderr $ usageInfo (header progName) options
+
+          putErrors errs =
+              hPutStrLn stderr $ intercalate ", " $ map (dropWhileEnd (== '\n')) errs
+          
+          processOpts opts _ | Help `elem` opts = putUsage
+          processOpts opts nonOpts =
+              styleFn $ \mstyle -> (inFn $ \hIn -> fmarkH fmt hIn eOut mstyle)
+              where revOpts = reverse opts
+                    
+                    fmt = fmt' revOpts
+                        where fmt' [] = OutputDoc
+                              fmt' (Help:opts) = fmt' opts
+                              fmt' (StyleName _:opts) = fmt' opts
+                              fmt' (flag:opts) = flag
+
+                    styleFn = style' revOpts
+                        where style' [] = \fn -> fn Nothing
+                              style' (StyleName fp:opts) = \fn -> withFile fp ReadMode $ \h -> fn $ Just h
+                              style' (_:opts) = style' opts
+
+                    inFn = case nonOpts of
+                             [] -> \fn -> fn stdin
+                             _ -> withFile (last nonOpts) ReadMode
+
+                    eOut = case nonOpts of
+                             [] | fmt == OutputPdf -> error "cannot use stdin with PDF output format"
+                             _ | fmt == OutputPdf -> Right $ last nonOpts
+                             _ -> Left stdout
