Added the basics needed to generate XML from the AST using HaXml and DrIFT
This commit is contained in:
parent
4d09fd4a85
commit
117173f758
18
Makefile
18
Makefile
|
@ -81,5 +81,23 @@ haddock:
|
|||
clean:
|
||||
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.
|
||||
.SECONDARY:
|
||||
|
|
|
@ -20,6 +20,8 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
-- This is intended to be imported qualified as A.
|
||||
module AST where
|
||||
|
||||
{-! global : Haskell2Xml !-}
|
||||
|
||||
import Data.Generics
|
||||
|
||||
import Metadata
|
||||
|
|
|
@ -19,6 +19,8 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
-- | Metadata -- i.e. source position.
|
||||
module Metadata where
|
||||
|
||||
{-! global : Haskell2Xml !-}
|
||||
|
||||
import Data.Generics
|
||||
|
||||
import Utils
|
||||
|
|
Loading…
Reference in New Issue
Block a user