]> git.unchartedbackwaters.co.uk Git - francis/ofc.git/commitdiff
Add tentative second-level AST definitions.
authorFrancis Russell <francis@unchartedbackwaters.co.uk>
Tue, 25 Sep 2012 17:38:13 +0000 (18:38 +0100)
committerFrancis Russell <francis@unchartedbackwaters.co.uk>
Tue, 25 Sep 2012 17:39:54 +0000 (18:39 +0100)
OFC/Common.hs [new file with mode: 0644]
OFC/Parser.hs
OFC/SecondLevel.hs [new file with mode: 0644]
OFC/TopLevel.hs
ofc.cabal

diff --git a/OFC/Common.hs b/OFC/Common.hs
new file mode 100644 (file)
index 0000000..44f77c1
--- /dev/null
@@ -0,0 +1,7 @@
+module OFC.Common where
+
+data IndexType = 
+  FunctionIndex | 
+  SpinIndex | 
+  SpatialIndex 
+  deriving (Show, Eq, Enum, Bounded)
index 29f893be286eb333a072df0e8bda3bef2db6885f..903c220aa47fb79bf3aa76c920d511b7561b4b55 100644 (file)
@@ -1,4 +1,5 @@
 module OFC.Parser (runOFLParser) where
+import OFC.Common
 import OFC.TopLevel
 import OFC.TargetMapping
 import Data.Functor.Identity (Identity)
diff --git a/OFC/SecondLevel.hs b/OFC/SecondLevel.hs
new file mode 100644 (file)
index 0000000..df63c65
--- /dev/null
@@ -0,0 +1,31 @@
+module OFC.SecondLevel where
+import Data.Complex
+
+data Type = 
+  RealType | 
+  ComplexType |
+  IntegerType |
+  Psinc Integer | 
+  PsincReciprocal Integer
+
+data Expression = 
+  IndexedIdentifier String [String] |
+  Upsample |
+  Downsample |
+  Apply DiagonalOperator Expression |
+  Product Expression Expression |
+  InnerProduct Expression Expression
+
+data DiagonalOperator = 
+  PositionOperator OperatorExpr |
+  MomentumOperator OperatorExpr
+
+data OperatorExpr = 
+  ConstReal Double |
+  ConstComplex (Complex Double) |
+  ConstInteger Integer | 
+  Negate OperatorExpr |
+  LatticeComponent String |
+  Multiply OperatorExpr OperatorExpr |
+  Sum OperatorExpr String |
+  Power OperatorExpr OperatorExpr
index 91b3df9dcc3179daa8a133fbe02a62903e4776aa..8045fedbcc7d058dc8b162b15cfc8498be504860 100644 (file)
@@ -1,5 +1,6 @@
 module OFC.TopLevel where
 import OFC.TargetMapping
+import OFC.Common
 import Text.PrettyPrint
 import Data.List (foldl')
 import Data.Map (Map)
@@ -14,12 +15,6 @@ data BaseType =
   IntegerType 
   deriving (Show, Eq, Enum, Bounded)
 
-data IndexType = 
-  FunctionIndex | 
-  SpinIndex | 
-  SpatialIndex 
-  deriving (Show, Eq, Enum, Bounded)
-
 -- Expressions
 data Expression = 
   IndexedIdentifier String [String] |
index 7852547e92f433054e513c8758871318e3ae6033..574813fa3aac715aba47ffbea03849e8beee1df8 100644 (file)
--- a/ofc.cabal
+++ b/ofc.cabal
@@ -10,8 +10,10 @@ Library
   Hs-Source-Dirs:    .
   GHC-Options:       -Wall -fno-warn-missing-signatures
   Build-Depends:     base, containers, parsec >= 3, pretty, transformers
-  Exposed-Modules:   OFC.Parser
+  Exposed-Modules:   OFC.Common
+                     OFC.Parser
                      OFC.TopLevel
+                     OFC.SecondLevel
                      OFC.TargetMapping
 
 Executable ofc