Added a CHP backend option to Tock
This commit is contained in:
parent
aa10b0113d
commit
78716a2727
6
Main.hs
6
Main.hs
|
@ -42,6 +42,7 @@ import CompState
|
||||||
import Errors
|
import Errors
|
||||||
import FlowGraph
|
import FlowGraph
|
||||||
import GenerateC
|
import GenerateC
|
||||||
|
import GenerateCHP
|
||||||
import GenerateCPPCSP
|
import GenerateCPPCSP
|
||||||
import LexOccam
|
import LexOccam
|
||||||
import Metadata
|
import Metadata
|
||||||
|
@ -114,6 +115,7 @@ optBackend :: String -> OptFunc
|
||||||
optBackend s ps
|
optBackend s ps
|
||||||
= do backend <- case s of
|
= do backend <- case s of
|
||||||
"c" -> return BackendC
|
"c" -> return BackendC
|
||||||
|
"chp" -> return BackendCHP
|
||||||
"cppcsp" -> return BackendCPPCSP
|
"cppcsp" -> return BackendCPPCSP
|
||||||
"dumpast" -> return BackendDumpAST
|
"dumpast" -> return BackendDumpAST
|
||||||
"src" -> return BackendSource
|
"src" -> return BackendSource
|
||||||
|
@ -481,8 +483,8 @@ compile mode fn (outHandles@(outHandle, _), headerName)
|
||||||
let generator :: A.AST -> PassM ()
|
let generator :: A.AST -> PassM ()
|
||||||
generator
|
generator
|
||||||
= case csBackend optsPS of
|
= case csBackend optsPS of
|
||||||
BackendC -> generateC outHandles headerName
|
BackendC -> generateC outHandle
|
||||||
BackendCPPCSP -> generateCPPCSP outHandles headerName
|
BackendCPPCSP -> generateCPPCSP outHandle
|
||||||
BackendDumpAST -> liftIO . hPutStr outHandle . pshow
|
BackendDumpAST -> liftIO . hPutStr outHandle . pshow
|
||||||
BackendSource -> (liftIO . hPutStr outHandle) <.< showCode
|
BackendSource -> (liftIO . hPutStr outHandle) <.< showCode
|
||||||
generator ast2
|
generator ast2
|
||||||
|
|
|
@ -143,6 +143,7 @@ tock_SOURCES_hs += backends/AnalyseAsm.hs
|
||||||
tock_SOURCES_hs += backends/BackendPasses.hs
|
tock_SOURCES_hs += backends/BackendPasses.hs
|
||||||
tock_SOURCES_hs += backends/GenerateC.hs
|
tock_SOURCES_hs += backends/GenerateC.hs
|
||||||
tock_SOURCES_hs += backends/GenerateCBased.hs
|
tock_SOURCES_hs += backends/GenerateCBased.hs
|
||||||
|
tock_SOURCES_hs += backends/GenerateCHP.hs
|
||||||
tock_SOURCES_hs += backends/GenerateCPPCSP.hs
|
tock_SOURCES_hs += backends/GenerateCPPCSP.hs
|
||||||
tock_SOURCES_hs += backends/TLP.hs
|
tock_SOURCES_hs += backends/TLP.hs
|
||||||
tock_SOURCES_hs += checks/ArrayUsageCheck.hs
|
tock_SOURCES_hs += checks/ArrayUsageCheck.hs
|
||||||
|
|
30
backends/GenerateCHP.hs
Normal file
30
backends/GenerateCHP.hs
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
{-
|
||||||
|
Tock: a compiler for parallel languages
|
||||||
|
Copyright (C) 2008 University of Kent
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by the
|
||||||
|
Free Software Foundation, either version 2 of the License, or (at your
|
||||||
|
option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
-}
|
||||||
|
|
||||||
|
-- | Generate CHP code from the AST
|
||||||
|
module GenerateCHP where
|
||||||
|
|
||||||
|
import System.IO
|
||||||
|
|
||||||
|
import qualified AST as A
|
||||||
|
import Pass
|
||||||
|
|
||||||
|
generateCHP :: Handle -> A.AST -> PassM ()
|
||||||
|
generateCHP h tr = genAST tr
|
||||||
|
|
||||||
|
genAST _ = return ()
|
|
@ -45,7 +45,7 @@ data CompMode = ModeFlowGraph | ModeLex | ModeHTML | ModeParse | ModeCompile | M
|
||||||
deriving (Show, Data, Typeable, Eq)
|
deriving (Show, Data, Typeable, Eq)
|
||||||
|
|
||||||
-- | Backends that Tock can use.
|
-- | Backends that Tock can use.
|
||||||
data CompBackend = BackendC | BackendCPPCSP | BackendDumpAST | BackendSource
|
data CompBackend = BackendC | BackendCPPCSP | BackendCHP | BackendDumpAST | BackendSource
|
||||||
deriving (Show, Data, Typeable, Eq)
|
deriving (Show, Data, Typeable, Eq)
|
||||||
|
|
||||||
-- | Frontends that Tock can use.
|
-- | Frontends that Tock can use.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user