htcc-0.0.0.1: The full scratch implementation of tiny C compiler (x86_64)
Copyright(c) roki 2019
LicenseMIT
Maintainerfalgon53@yahoo.co.jp
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe
LanguageHaskell2010

Htcc.CRules.Types.CType

Description

The rules of types of C language

Synopsis

Documentation

class CType a where Source #

A data type representing the type of C language

Methods

isFundamental :: a -> Bool Source #

isFundamental returns True only if the type is fundamental type (See also: § 3.9.1), otherwise retunrs False.

qualify :: a -> a -> Maybe a Source #

If the first argument is a type qualifier, qualify returns a type that qualifies the type of the second argument with that qualifier. Otherwise Nothing is returned.

sizeof :: a -> Natural Source #

sizeof returns the byte size of the type defined by C language.

alignof :: a -> Natural Source #

alignof returns the alignment of the type defiend by C language.

deref :: a -> Maybe a Source #

deref returns Just x for the underlying type x only if a is CTPtr or CTArray. Otherwise returns Nothing.

ctorPtr :: Natural -> a -> a Source #

ctorPtr returns a convolution function with \(n\) specified pointers nested

dctorPtr :: a -> (a, a -> a) Source #

dctorPtr deconstructs the nested structure of CTPtr and returns the convolution function of the original type and CTPtr

dctorArray :: a -> (a, a -> a) Source #

dctorArray deconstructs the nested structure of CTArray and returns the convolution function of the original type and CTArray

removeAllExtents :: a -> a Source #

removeAllExtents is the same as std::remove_all_extents defined in C++11 <type_traits> (See also: N3337/§ 20.9.7.4) header. If type T is a multidimensional array of type X, type X is returned. Otherwise, it returns type T.

conversion :: a -> a -> a Source #

conversion defines one type from two types according to the implicit conversion defined in §6.3.1.8

implicitInt :: a -> a Source #

implicitInt sets long or short type declarations for type declarations with only modifiers such as long and short. Otherwise, nothing to do.

Instances

Instances details
Ord i => CType (TypeKind i) Source # 
Instance details

Defined in Htcc.CRules.Types.TypeKind

Ord i => CType (StorageClass i) Source # 
Instance details

Defined in Htcc.CRules.Types.StorageClass