Safe Haskell | None |
---|---|
Language | Haskell98 |
Parrot PIR syntax tree.
All that is gold does not glitter, Not all those who wander are lost; The old that is strong does not wither, Deep roots are not reached by the frost.
- type PIR = [Decl]
- data Decl
- data Stmt
- data Ins
- = InsLocal !RegType !VarName
- | InsNew !LValue !ObjType
- | InsBind !LValue !Expression
- | InsAssign !LValue !Expression
- | InsPrim !(Maybe LValue) !PrimName ![Expression]
- | InsFun ![Sig] !Expression ![Expression]
- | InsTailFun !Expression ![Expression]
- | InsLabel !LabelName
- | InsComment !String !(Maybe Ins)
- | InsExp !Expression
- | InsConst !LValue !ObjType !Expression
- data Expression
- data LValue
- data Literal
- data SubFlag
- data RegType
- data ObjType
- type LabelName = String
- type SubName = String
- type VarName = String
- type PrimName = String
- type PkgName = String
- type CallConv = String
- emitStmts :: [Stmt] -> Doc
- curPad :: Int
- emitRets :: [Sig] -> Doc
- emitFun :: (Emit b, Emit c) => CallConv -> b -> [c] -> [Sig] -> Doc
- emitArgs :: Emit a => [a] -> Doc
- emitFunName :: Emit b => CallConv -> String -> [b] -> [Sig] -> Doc
- noArgs :: [Expression]
- expKeyed :: LValue -> Expression -> Expression
- quoted :: String -> String
- include :: PkgName -> Decl
- hll :: String -> String -> Decl
- (<:=) :: LValue -> Expression -> Ins
- (<==) :: LValue -> Expression -> Ins
- (<--) :: LValue -> PrimName -> [Expression] -> Ins
- (.-) :: PrimName -> [Expression] -> Ins
- (<-&) :: [Sig] -> Expression -> [Expression] -> Ins
- (.&) :: Expression -> [Expression] -> Ins
- lit0 :: Expression
- nullPMC :: RegClass a => a
- funPMC :: RegClass a => a
- rv :: RegClass a => a
- arg0 :: RegClass a => a
- arg1 :: RegClass a => a
- arg2 :: RegClass a => a
- arg3 :: RegClass a => a
- tempPMC :: RegClass a => a
- tempPMC2 :: RegClass a => a
- tempSTR :: RegClass a => a
- tempSTR2 :: RegClass a => a
- tempSTR3 :: RegClass a => a
- tempINT :: RegClass a => a
- tempINT2 :: RegClass a => a
- tempINT3 :: RegClass a => a
- tempINT4 :: RegClass a => a
- tempNUM :: RegClass a => a
- tempNUM2 :: RegClass a => a
- class RegClass y where
- class LiteralClass x where
- lit :: x -> Expression
- sub :: SubName -> [Sig] -> [Ins] -> Decl
- sigList :: [Sig] -> [Expression]
- data Sig = MkSig {
- sigFlags :: [ArgFlag]
- sigIdent :: Expression
- data ArgFlag
- argVal :: ArgFlag -> Int
- maybeFlatten :: Doc
- slurpy :: Expression -> Sig
- (-->) :: Decl -> [Expression] -> Decl
- retSigList :: [Expression] -> [Expression]
- vop1 :: SubName -> PrimName -> Decl
- vop2 :: SubName -> PrimName -> Decl
- vop2keyed :: SubName -> LValue -> Decl
- vop1x :: SubName -> PrimName -> (forall a. RegClass a => a) -> (forall b. RegClass b => b) -> Decl
- vop1coerce :: SubName -> (forall a. RegClass a => a) -> Decl
- vop2x :: SubName -> PrimName -> (forall a. RegClass a => a) -> (forall b. RegClass b => b) -> (forall c. RegClass c => c) -> Decl
- vop1ii :: SubName -> PrimName -> Decl
- vop1nn :: SubName -> PrimName -> Decl
- vop1ss :: SubName -> PrimName -> Decl
- vop1si :: SubName -> PrimName -> Decl
- vop1is :: SubName -> PrimName -> Decl
- vop1ip :: SubName -> PrimName -> Decl
- vop2iii :: SubName -> PrimName -> Decl
- vop2nnn :: SubName -> PrimName -> Decl
- vop2iss :: SubName -> PrimName -> Decl
- bare :: VarName -> Expression
- collectCC :: [Ins]
- callThunkCC :: Expression -> [Ins]
- stmtControlLoop :: VarName -> PrimName -> Decl
- stmtControlCond :: VarName -> PrimName -> Decl
- op2Logical :: VarName -> PrimName -> Decl
- escaped :: String -> String
- preludePIR :: Doc
- class Show x => Emit x where
- nested :: Emit x => x -> Doc
- eqSep :: (Emit a, Emit b, Emit c) => a -> b -> [c] -> Doc
- commaSep :: Emit x => [x] -> Doc
Documentation
InsLocal !RegType !VarName |
|
InsNew !LValue !ObjType |
|
InsBind !LValue !Expression |
|
InsAssign !LValue !Expression |
|
InsPrim !(Maybe LValue) !PrimName ![Expression] | Other opcodes |
InsFun ![Sig] !Expression ![Expression] | Function call |
InsTailFun !Expression ![Expression] | Tail call |
InsLabel !LabelName | Label |
InsComment !String !(Maybe Ins) | Comment |
InsExp !Expression | Generic expressions |
InsConst !LValue !ObjType !Expression | Constant |
data Expression Source
Tags a PIR subroutine definition with @MAIN
, @LOAD
, @ANON
,
@METHOD
, or @MULTI
.
A PMC type, which, for example, can be given as an argument to the new
opcode (e.g. new .PerlScalar
).
noArgs :: [Expression] Source
expKeyed :: LValue -> Expression -> Expression Source
(<--) :: LValue -> PrimName -> [Expression] -> Ins infixl 4 Source
Calls an opcode which returns a value.
(.-) :: PrimName -> [Expression] -> Ins infixl 4 Source
Calls an opcode, ignoring any return values.
(<-&) :: [Sig] -> Expression -> [Expression] -> Ins infixl 4 Source
Calls an user-defined sub which returns a list of values.
(.&) :: Expression -> [Expression] -> Ins infixl 4 Source
Calls an user-defined sub, ignoring any return values.
lit0 :: Expression Source
Literal zero
class LiteralClass x where Source
lit :: x -> Expression Source
:: SubName | Name of the subroutine |
-> [Sig] | Signature |
-> [Ins] | Subroutine body |
-> Decl | The final subroutine declaration |
Subroutine declaration.
sigList :: [Sig] -> [Expression] Source
MkSig | |
|
slurpy :: Expression -> Sig Source
Marks a parameter as slurpy.
(-->) :: Decl -> [Expression] -> Decl infixl 9 Source
Returns from a sub.
retSigList :: [Expression] -> [Expression] Source
In the case a Perl 6 builtin corresponds exactly to a PIR opcode, you can
use vop1
to create an appropriate wrapper for an opcode expecting one
argument.
In the case a Perl 6 builtin corresponds exactly to a PIR opcode, you can
use vop2
to create an appropriate wrapper for an opcode expecting two
arguments.
:: SubName | Perl 6 name of the sub to create |
-> LValue | Intermediate register to convert the index to
(e.g. |
-> Decl | Final subroutine declaration |
Creates a sub which accepts a thing which allows keyed access (for example aggregates) and an index.
:: SubName | Perl 6 name of the sub to create |
-> PrimName | Opcode to wrap |
-> (forall a. RegClass a => a) | Register to use for the return value of the op |
-> (forall b. RegClass b => b) | Register type to convert the parameter to |
-> Decl | Final subroutine declaration |
Generic wrapper for unary opcodes.
:: SubName | Perl 6 name of the sub to create |
-> (forall a. RegClass a => a) | Register type to convert the parameter to |
-> Decl | Final subroutine declaration |
Generic wrapper for coercion/context forcing (used by &prefix:<+>
,
&prefix:<~>
, etc.)
:: SubName | Perl 6 name of the sub to create |
-> PrimName | Opcode to wrap |
-> (forall a. RegClass a => a) | Register to use for the return value of the op |
-> (forall b. RegClass b => b) | Register type to convert the first parameter to |
-> (forall c. RegClass c => c) | Register type to convert the second parameter to |
-> Decl | Final subroutine declaration |
Generic wrapper for two-ary opcodes.
vop1ii :: SubName -> PrimName -> Decl Source
Wrapper for an opcode which accepts and returns an I
register.
vop1nn :: SubName -> PrimName -> Decl Source
Wrapper for an opcode which accepts and returns a N
register.
vop1ss :: SubName -> PrimName -> Decl Source
Wrapper for an opcode which accepts and returns a S
register.
vop1si :: SubName -> PrimName -> Decl Source
Wrapper for an opcode which returns a S
register and accepts a I
register.
vop1is :: SubName -> PrimName -> Decl Source
Wrapper for an opcode which returns a I
register and accepts a S
register.
vop1ip :: SubName -> PrimName -> Decl Source
Wrapper for an opcode which returns a I
register and accepts a P
register.
vop2iii :: SubName -> PrimName -> Decl Source
Wrapper for an opcode which accepts and returns I
registers.
vop2nnn :: SubName -> PrimName -> Decl Source
Wrapper for an opcode which accepts and returns N
registers.
vop2iss :: SubName -> PrimName -> Decl Source
Wrapper for an opcode which accepts two S
registers and returns a native
integer (I
register).
bare :: VarName -> Expression Source
callThunkCC :: Expression -> [Ins] Source
:: VarName | Perl 6 name of the new sub |
-> PrimName | PIR opcode to use for branching |
-> Decl | Final declaration of the sub |
Creates appropriate &statement_control:foo
subroutines.
:: VarName | Perl 6 name of the new sub |
-> PrimName | PIR opcode to use for branching |
-> Decl | Final declaration of the sub |
Creates appropriate &statement_control:foo
subroutines.
:: VarName | Perl 6 name of the sub to create |
-> PrimName | PIR opcode to use ( |
-> Decl | Final declaration of the sub |
Creates appropriate &infix:foo
subs for logical operators (||
, &&
,
etc.).
preludePIR :: Doc Source
The Prelude, defining primitives like &say
, &infix:+
, etc.
Generated by DrIFT : Look, but Don't Touch. *
class Show x => Emit x where Source
Emit Int Source | |
Emit String Source | |
Emit Doc Source | |
Emit ObjType Source | Emits PIR code for an |
Emit RegType Source | |
Emit SubFlag Source | Emits PIR code for a |
Emit Literal Source | Emits a literal (a |
Emit LValue Source | |
Emit Expression Source | |
Emit Ins Source | |
Emit Stmt Source | |
Emit Decl Source | Emits PIR code for declarations (namespace, include, or sub declarations). |
Emit a => Emit [a] Source | |
Emit [ArgFlag] Source | |
Emit a => Emit (Maybe a) Source |