{- $Id: test-gener.hs,v 1.1.2.3 2009/02/20 18:00:05 orlov Exp $ -}
{- vim: set syntax=haskell expandtab tabstop=4: -}
{-module Main (
main, test
) where
-}
import Prelude
import Parser
import System
import Gener
import qualified XSG
gen3 :: FileName -> String -> String -> (XState, XState, XState)
gen3 file str1 str2 = genStates st1 st2 idx1
where (tbl, prog) = compileFile file
br1 = parse' pBranchA str1
br2 = parse' pBranchA str2
st1 = compileBranch tbl idx2 [] br1
st2 = compileBranch tbl idx3 [] br2
idx1:idx2:idx3:_ = XSG.newIdxs XSG.initIdx
zzz :: (XSG.Vars, (XSG.Terms, XSG.Exps)) -> Parser.Branch
zzz (v,(t,e)) = uncompileBranch (v,(t, [], e))
gen2 file str1 str2 = map zzz [x1,x2,x3]
where (x1, x2, x3) = gen3 file str1 str2
ttt file str1 = uncompileBranch (args,st1)
where (tbl, prog) = compileFile file
br1 = parse' pBranchA str1
st1 = compileBranch tbl idx2 [] br1
args = XSG.getXVars st1
idx1:idx2:idx3:_ = XSG.newIdxs XSG.initIdx
{-
class Renum a where
renum :: a -> a
instance Renum XSG.Var where
renum (XSG.W vN) = XSG.X vN
renum (XSG.X vN) = XSG.X vN
renum (XSG.L vN) = XSG.L vN
instance Renum XSG.Exp where
renum (XSG.VAR v ) = XSG.VAR (renum v)
renum (XSG.C (cN, cN') es) = XSG.C (cN, cN') (renum es)
instance Renum XSG.Clash where
renum (e1 XSG.:=:e2) = (renum e1)XSG.:=:(renum e2)
instance Renum XSG.Term where
renum (vs XSG.:=(fn, es)) = (renum vs)XSG.:=(fn, renum es)
instance Renum XSG.Func where
renum (XSG.FUNC fN vs body) = XSG.FUNC fN (renum vs) (renum body)
instance Renum a => Renum [a] where
renum xs = map renum xs
instance (Renum a, Renum b, Renum c) => Renum (a, b, c) where
renum (x, y, z) = (renum x, renum y, renum z)
-}