diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,9 @@
+Copyright (c) 2013, Pedro Martins
+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 the <ORGANIZATION> nor the names of its 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 HOLDER 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/README b/README
new file mode 100644
--- /dev/null
+++ b/README
@@ -0,0 +1,25 @@
+This source code complements the paper
+Zipper-based Attribute Grammars and their Extensions. Pedro Martins, João Paulo Fernandes and João Saraiva. In the proceedings of the 17th Brazilian Symposium on Programming Languages (SBLP’13), September 29 - October 4, Brasilia, Brasil. LNCS
+
+To run all the examples, the Scrap Your Zipper Haskell package
+is necessary, which can be easily installed with:
+
+$ cabal install syz
+
+The examples run with:
+
+$ghci (name_of_file)
+
+To run the AGs, one must write in ghci:
+
+for the files DESK*
+$ semantics program
+
+for the file HTMLTableFormatter.hs
+$ semantics table
+
+for the file RepMin.hs
+$ semantics tree
+
+for the file SmartParentesis.hs
+$ semantics expr
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/ZipperAG.cabal b/ZipperAG.cabal
new file mode 100644
--- /dev/null
+++ b/ZipperAG.cabal
@@ -0,0 +1,20 @@
+Name:		   ZipperAG
+Version:	   0.1
+Cabal-Version: >= 1.2
+License:	   BSD3
+Author:		   Pedro Martins <pedromartins4@gmail.com>
+Maintainer:    Pedro Martins <pedromartins4@gmail.com>
+Homepage:	   www.di.uminho.pt/~prmartins
+Category:	   Experimental
+Synopsis:	   An implementationg of Attribute Grammars using Funcitonal Zippers
+Description:   An implementationg of Attribute Grammars using Funcitonal Zippers
+build-type:    Simple
+Copyright:     Pedro Martins
+Extra-source-files: README
+license-file:  LICENSE
+
+Library
+  Build-Depends:	base >= 2 && <= 4.6.0.1, syz
+  Exposed-modules:  Language.Grammars.ZipperAG
+  hs-source-dirs:   src 
+
diff --git a/src/Language/Grammars/ZipperAG.hs b/src/Language/Grammars/ZipperAG.hs
new file mode 100644
--- /dev/null
+++ b/src/Language/Grammars/ZipperAG.hs
@@ -0,0 +1,31 @@
+-- |
+-- Module      :  ZipperAG
+-- Copyright   :  2013 Pedro Martins
+-- License     :  BSD3
+--
+-- Maintainer  :  Pedro Martins <pedromartins4@gmail.com>
+-- Stability   :  Experimental
+-- Portability :  Portable
+--
+-- Zipper-based AG supporting functions
+module Language.Grammars.ZipperAG where
+
+import Data.Generics.Zipper
+import Data.Maybe
+
+-- |Gives the n'th child
+(.$) :: Zipper a -> Int -> Zipper a
+z .$ 1 = fromJust (down' z)
+z .$ n = fromJust (right ( z.$(n-1) ))
+
+-- |parent
+parent = fromJust.up
+
+-- |Tests if z is the n'th sibling
+(.|) :: Zipper a -> Int -> Bool
+z .| 1 = case (left z) of
+			Nothing -> False
+			_ -> True
+z .| n = case (left z) of
+			Nothing -> False
+			Just x ->  z .| (n-1)
