Safe Haskell | Safe-Infered |
---|
- CLARIS
- C++-Like Abstract Representation of Intermediate Syntax.
Claris connects the higher-level concepts to native languages with capability to describe C++ syntax such as classes and containers. Claris also have support for extension made by C++-like languages such as CUDA qualifier and kernel call.
The design goal of Claris is to cover the necessity of the code generation and to make it simple. Claris is not designed for syntatic correctness, and it's possible to describe a Claris code that will cause a compile error in C++.
In Claris, variables, functions and classes are described in a unified manner that supports both the declaration and definition. From that information, the declarations and definitions are generated at appropriate places.
- data Program = Program {}
- data FileType
- = HeaderFile
- | SourceFile
- data Statement
- = StmtPrpr Preprocessing
- | UsingNamespace Name
- | ClassDef Class
- | FuncDef Function
- | VarDef Var
- | VarDefCon Var [Expr]
- | VarDefSub Var Expr
- | StmtExpr Expr
- | StmtWhile Expr [Statement]
- | StmtFor Statement Expr Expr [Statement]
- | StmtReturn Expr
- | Exclusive FileType Statement
- | RawStatement Text
- | Comment Text
- data Preprocessing
- = PrprInclude Parenthesis Text
- | PrprPragma Text
- data TypeRep
- = UnitType TypeRep
- | PtrOf TypeRep
- | RefOf TypeRep
- | Const TypeRep
- | TemplateType Text [TypeRep]
- | QualifiedType [Qualifier] TypeRep
- | ConstructorType
- | UnknownType
- typeOf :: Typeable a => a -> TypeRep
- toDyn :: Typeable a => a -> Expr
- data Class = Class {
- className :: Name
- classMember :: [MemberDef]
- data MemberDef
- = MemberFunc { }
- | MemberVar { }
- data AccessModifier
- data Function = Function {}
- function :: TypeRep -> Name -> Function
- data Qualifier
- = CudaGlobal
- | CudaDevice
- | CudaHost
- | CudaShared
- | CudaConst
- data Var = Var TypeRep Name
- data Expr
- = Imm Dynamic
- | VarExpr Var
- | FuncCallUsr Name [Expr]
- | FuncCallStd Text [Expr]
- | CudaFuncCallUsr Name Expr Expr [Expr]
- | MemberAccess Expr Expr
- | Op1Prefix Text Expr
- | Op1Postfix Text Expr
- | Op2Infix Text Expr Expr
- | Op3Infix Text Text Expr Expr Expr
- | ArrayAccess Expr Expr
- | CommentExpr Text Expr
- data Parenthesis
Documentation
A Claris program.
C++ class descriptions are separated to two files
C++ top-level statements
StmtPrpr Preprocessing | Preprosessor directive |
UsingNamespace Name | Name space declaration |
ClassDef Class | Class definition |
FuncDef Function | Function definition |
VarDef Var | variable definition as an expression |
VarDefCon Var [Expr] | define a variable and call a constructor |
VarDefSub Var Expr | define a variable and substitute a value |
StmtExpr Expr | Expression |
StmtWhile Expr [Statement] | While loop |
StmtFor Statement Expr Expr [Statement] | For loop |
StmtReturn Expr | return |
Exclusive FileType Statement | A statement that is included exclusively in either of the file type |
RawStatement Text | text directly embedded into source code |
Comment Text | a comment |
description C++ type
UnitType TypeRep | Types for simple objects |
PtrOf TypeRep | Pointer type |
RefOf TypeRep | Reference type |
Const TypeRep | Constant type |
TemplateType Text [TypeRep] | A template type |
QualifiedType [Qualifier] TypeRep | Qualified type |
ConstructorType | the type of mu which is returned from constructor / destructor |
UnknownType | the type of kuu that is detached from reincarnation |
C++ class
Class | |
|
C++ class member definition
MemberFunc | A member function |
| |
MemberVar | A member variable |
data AccessModifier Source
C++ class member access modifier
C++ syntax for variable definition
C++ function definition
- CUDA extension
- qualifiers to use accelerator
C++ Variable definition
C++ Expression
Imm Dynamic | an immediate |
VarExpr Var | an expression made of a variable |
FuncCallUsr Name [Expr] | user function call |
FuncCallStd Text [Expr] | builtin function call |
CudaFuncCallUsr Name Expr Expr [Expr] | cuda function call with Grid topology |
MemberAccess Expr Expr | access a member of an object |
Op1Prefix Text Expr | prefix unary operator |
Op1Postfix Text Expr | postfix unary operator |
Op2Infix Text Expr Expr | infix binary operator |
Op3Infix Text Text Expr Expr Expr | sandwiched trinity operator |
ArrayAccess Expr Expr | access a component of an array |
CommentExpr Text Expr | commented expr |