Added the basics needed to generate XML from the AST using HaXml and DrIFT

This commit is contained in:
Neil Brown 2007-09-14 19:13:15 +00:00
parent 4d09fd4a85
commit 117173f758
3 changed files with 22 additions and 0 deletions

View File

@ -81,5 +81,23 @@ haddock:
clean: clean:
rm -f $(targets) $(builtfiles) obj/*.o obj/*.hi rm -f $(targets) $(builtfiles) obj/*.o obj/*.hi
#This generates the ASTXML module, which is not currently used anywhere in Tock.
#It requires the HaXml modules (1.13.x or earlier), and the DrIFT preprocessor, urls:
# http://www.cs.york.ac.uk/fp/HaXml/
# http://repetae.net/~john/computer/haskell/DrIFT/
#I had to exclude a few other definitions from the imports because AST has entries like True,
#and we cannot get DrIFT to import AST qualified. The alternative would be to append the
#instances from DrIFT to AST.hs itself, but I didn't want to do that just yet:
common/ASTXML.hs: common/AST.hs common/Metadata.hs
echo -e "module ASTXML where\n" > common/ASTXML.hs
echo -e "import AST\n" >> common/ASTXML.hs
echo -e "import Metadata\n" >> common/ASTXML.hs
echo -e "import Text.XML.HaXml.Haskell2Xml hiding (Seq, TagName, Name, Plus, Choice)\n" >> common/ASTXML.hs
echo -e "import Prelude hiding (True,False)\n" >> common/ASTXML.hs
cd common && DrIFT -r AST.hs >> ASTXML.hs
cd common && DrIFT -r Metadata.hs >> ASTXML.hs
# Don't delete intermediate files. # Don't delete intermediate files.
.SECONDARY: .SECONDARY:

View File

@ -20,6 +20,8 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
-- This is intended to be imported qualified as A. -- This is intended to be imported qualified as A.
module AST where module AST where
{-! global : Haskell2Xml !-}
import Data.Generics import Data.Generics
import Metadata import Metadata

View File

@ -19,6 +19,8 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
-- | Metadata -- i.e. source position. -- | Metadata -- i.e. source position.
module Metadata where module Metadata where
{-! global : Haskell2Xml !-}
import Data.Generics import Data.Generics
import Utils import Utils