language-c-0.6.1: Analysis and generation of C code

Copyright | (c) 2008 Benedikt Huber
License | BSD-style
Maintainer | benedikt.huber@gmail.com
Stability | experimental
Portability | ghc
Safe Haskell | None
Language | Haskell98

Language.C.Syntax.Ops

Contents

- Assignment operators
- Binary operators
- Unary operators

Description

Unary, binary and asssignment operators. Exported via AST.

Synopsis

- data CAssignOp
  - = CAssignOp
  - | CMulAssOp
  - | CDivAssOp
  - | CRmdAssOp
  - | CAddAssOp
  - | CSubAssOp
  - | CShlAssOp
  - | CShrAssOp
  - | CAndAssOp
  - | CXorAssOp
  - | COrAssOp
- assignBinop :: CAssignOp -> CBinaryOp
- data CBinaryOp
  - = CMulOp
  - | CDivOp
  - | CRmdOp
  - | CAddOp
  - | CSubOp
  - | CShlOp
  - | CShrOp
  - | CLeOp
  - | CGrOp
  - | CLeqOp
  - | CGeqOp
  - | CEqOp
  - | CNeqOp
  - | CAndOp
  - | CXorOp
  - | COrOp
  - | CLndOp
  - | CLorOp
- isCmpOp :: CBinaryOp -> Bool
- isPtrOp :: CBinaryOp -> Bool
- isBitOp :: CBinaryOp -> Bool
- isLogicOp :: CBinaryOp -> Bool
- data CUnaryOp
  - = CPreIncOp
  - | CPreDecOp
  - | CPostIncOp
  - | CPostDecOp
  - | CAdrOp
  - | CIndOp
  - | CPlusOp
  - | CMinOp
  - | CCompOp
  - | CNegOp
- isEffectfulOp :: CUnaryOp -> Bool

# Assignment operators

data CAssignOp #

C assignment operators (K&R A7.17)

Constructors

CAssignOp |
CMulAssOp |
CDivAssOp |
CRmdAssOp | remainder and assignment
CAddAssOp |
CSubAssOp |
CShlAssOp |
CShrAssOp |
CAndAssOp |
CXorAssOp |
COrAssOp |

Instances

Eq CAssignOp # |
Methods (==) :: CAssignOp -> CAssignOp -> Bool # (/=) :: CAssignOp -> CAssignOp -> Bool #
Data CAssignOp # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CAssignOp -> c CAssignOp # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CAssignOp # toConstr :: CAssignOp -> Constr # dataTypeOf :: CAssignOp -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c CAssignOp) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CAssignOp) # gmapT :: (forall b. Data b => b -> b) -> CAssignOp -> CAssignOp # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CAssignOp -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CAssignOp -> r # gmapQ :: (forall d. Data d => d -> u) -> CAssignOp -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> CAssignOp -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> CAssignOp -> m CAssignOp # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CAssignOp -> m CAssignOp # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CAssignOp -> m CAssignOp #
Ord CAssignOp # |
Methods compare :: CAssignOp -> CAssignOp -> Ordering # (<) :: CAssignOp -> CAssignOp -> Bool # (<=) :: CAssignOp -> CAssignOp -> Bool # (>) :: CAssignOp -> CAssignOp -> Bool # (>=) :: CAssignOp -> CAssignOp -> Bool # max :: CAssignOp -> CAssignOp -> CAssignOp # min :: CAssignOp -> CAssignOp -> CAssignOp #
Show CAssignOp # |
Methods showsPrec :: Int -> CAssignOp -> ShowS # show :: CAssignOp -> String # showList :: [CAssignOp] -> ShowS #
Pretty CAssignOp # |
Methods pretty :: CAssignOp -> Doc # prettyPrec :: Int -> CAssignOp -> Doc #

assignBinop :: CAssignOp -> CBinaryOp #

# Binary operators

data CBinaryOp #

C binary operators (K&R A7.6-15)

Constructors

CMulOp |
CDivOp |
CRmdOp | remainder of division
CAddOp |
CSubOp |
CShlOp | shift left
CShrOp | shift right
CLeOp | less
CGrOp | greater
CLeqOp | less or equal
CGeqOp | greater or equal
CEqOp | equal
CNeqOp | not equal
CAndOp | bitwise and
CXorOp | exclusive bitwise or
COrOp | inclusive bitwise or
CLndOp | logical and
CLorOp | logical or

Instances

Eq CBinaryOp # |
Methods (==) :: CBinaryOp -> CBinaryOp -> Bool # (/=) :: CBinaryOp -> CBinaryOp -> Bool #
Data CBinaryOp # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CBinaryOp -> c CBinaryOp # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CBinaryOp # toConstr :: CBinaryOp -> Constr # dataTypeOf :: CBinaryOp -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c CBinaryOp) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CBinaryOp) # gmapT :: (forall b. Data b => b -> b) -> CBinaryOp -> CBinaryOp # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CBinaryOp -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CBinaryOp -> r # gmapQ :: (forall d. Data d => d -> u) -> CBinaryOp -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> CBinaryOp -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> CBinaryOp -> m CBinaryOp # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CBinaryOp -> m CBinaryOp # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CBinaryOp -> m CBinaryOp #
Ord CBinaryOp # |
Methods compare :: CBinaryOp -> CBinaryOp -> Ordering # (<) :: CBinaryOp -> CBinaryOp -> Bool # (<=) :: CBinaryOp -> CBinaryOp -> Bool # (>) :: CBinaryOp -> CBinaryOp -> Bool # (>=) :: CBinaryOp -> CBinaryOp -> Bool # max :: CBinaryOp -> CBinaryOp -> CBinaryOp # min :: CBinaryOp -> CBinaryOp -> CBinaryOp #
Show CBinaryOp # |
Methods showsPrec :: Int -> CBinaryOp -> ShowS # show :: CBinaryOp -> String # showList :: [CBinaryOp] -> ShowS #
Pretty CBinaryOp # |
Methods pretty :: CBinaryOp -> Doc # prettyPrec :: Int -> CBinaryOp -> Doc #

isCmpOp :: CBinaryOp -> Bool #

isPtrOp :: CBinaryOp -> Bool #

isBitOp :: CBinaryOp -> Bool #

isLogicOp :: CBinaryOp -> Bool #

# Unary operators

data CUnaryOp #

C unary operator (K&R A7.3-4)

Constructors

CPreIncOp | prefix increment operator
CPreDecOp | prefix decrement operator
CPostIncOp | postfix increment operator
CPostDecOp | postfix decrement operator
CAdrOp | address operator
CIndOp | indirection operator
CPlusOp | prefix plus
CMinOp | prefix minus
CCompOp | one's complement
CNegOp | logical negation

Instances

Eq CUnaryOp # |
Methods (==) :: CUnaryOp -> CUnaryOp -> Bool # (/=) :: CUnaryOp -> CUnaryOp -> Bool #
Data CUnaryOp # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CUnaryOp -> c CUnaryOp # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CUnaryOp # toConstr :: CUnaryOp -> Constr # dataTypeOf :: CUnaryOp -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c CUnaryOp) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CUnaryOp) # gmapT :: (forall b. Data b => b -> b) -> CUnaryOp -> CUnaryOp # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CUnaryOp -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CUnaryOp -> r # gmapQ :: (forall d. Data d => d -> u) -> CUnaryOp -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> CUnaryOp -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> CUnaryOp -> m CUnaryOp # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CUnaryOp -> m CUnaryOp # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CUnaryOp -> m CUnaryOp #
Ord CUnaryOp # |
Methods compare :: CUnaryOp -> CUnaryOp -> Ordering # (<) :: CUnaryOp -> CUnaryOp -> Bool # (<=) :: CUnaryOp -> CUnaryOp -> Bool # (>) :: CUnaryOp -> CUnaryOp -> Bool # (>=) :: CUnaryOp -> CUnaryOp -> Bool # max :: CUnaryOp -> CUnaryOp -> CUnaryOp # min :: CUnaryOp -> CUnaryOp -> CUnaryOp #
Show CUnaryOp # |
Methods showsPrec :: Int -> CUnaryOp -> ShowS # show :: CUnaryOp -> String # showList :: [CUnaryOp] -> ShowS #
Pretty CUnaryOp # |
Methods pretty :: CUnaryOp -> Doc # prettyPrec :: Int -> CUnaryOp -> Doc #

isEffectfulOp :: CUnaryOp -> Bool #