Jikka-5.0.11.1: A transpiler from Python to C++ for competitive programming
Copyright(c) Kimiyuki Onaka 2020
LicenseApache License 2.0
Maintainerkimiyuki95@gmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Jikka.Python.Language.Expr

Description

Expr module has the basic data types for the standard Python. See the Python's ast module (https://docs.python.org/ja/3/library/ast.html#abstract-grammar) for reference.

Synopsis

Documentation

newtype Ident Source #

Constructors

Ident String 

Instances

Instances details
Eq Ident Source # 
Instance details

Defined in Jikka.Python.Language.Expr

Methods

(==) :: Ident -> Ident -> Bool #

(/=) :: Ident -> Ident -> Bool #

Ord Ident Source # 
Instance details

Defined in Jikka.Python.Language.Expr

Methods

compare :: Ident -> Ident -> Ordering #

(<) :: Ident -> Ident -> Bool #

(<=) :: Ident -> Ident -> Bool #

(>) :: Ident -> Ident -> Bool #

(>=) :: Ident -> Ident -> Bool #

max :: Ident -> Ident -> Ident #

min :: Ident -> Ident -> Ident #

Read Ident Source # 
Instance details

Defined in Jikka.Python.Language.Expr

Show Ident Source # 
Instance details

Defined in Jikka.Python.Language.Expr

Methods

showsPrec :: Int -> Ident -> ShowS #

show :: Ident -> String #

showList :: [Ident] -> ShowS #

IsString Ident Source # 
Instance details

Defined in Jikka.Python.Language.Expr

Methods

fromString :: String -> Ident #

data Statement Source #

data Expr Source #

Constructors

BoolOp Expr' BoolOp Expr' 
NamedExpr Target' Expr'

produced by the walrus operator :=

BinOp Expr' Operator Expr' 
UnaryOp UnaryOp Expr' 
Lambda Arguments Expr' 
IfExp Expr' Expr' Expr'
IfExp test body orelse
Dict [(Maybe Expr', Expr')]

NULL key is for **d.

Set [Expr'] 
ListComp Expr' [Comprehension] 
SetComp Expr' [Comprehension] 
DictComp Expr' Expr' [Comprehension] 
GeneratorExp Expr' [Comprehension] 
Await Expr' 
Yield (Maybe Expr') 
YieldFrom Expr' 
Compare Expr' [(CmpOp, Expr')] 
Call Expr' [Expr'] [Keyword'] 
FormattedValue Expr' (Maybe Char) (Maybe Expr')

FormattedValue value conversion format_spec for f-strings

JoinedStr [Expr'] 
Constant Constant 
Attribute Expr' Ident'

can appear in assignment context

Subscript Expr' Expr'

can appear in assignment context

Starred Expr'

can appear in assignment context

Name Ident'

can appear in assignment context

List [Expr']

can appear in assignment context

Tuple [Expr']

can appear in assignment context

Slice (Maybe Expr') (Maybe Expr') (Maybe Expr')

Slice lower upper step can appear only in Subscript

Instances

Instances details
Eq Expr Source # 
Instance details

Defined in Jikka.Python.Language.Expr

Methods

(==) :: Expr -> Expr -> Bool #

(/=) :: Expr -> Expr -> Bool #

Ord Expr Source # 
Instance details

Defined in Jikka.Python.Language.Expr

Methods

compare :: Expr -> Expr -> Ordering #

(<) :: Expr -> Expr -> Bool #

(<=) :: Expr -> Expr -> Bool #

(>) :: Expr -> Expr -> Bool #

(>=) :: Expr -> Expr -> Bool #

max :: Expr -> Expr -> Expr #

min :: Expr -> Expr -> Expr #

Read Expr Source # 
Instance details

Defined in Jikka.Python.Language.Expr

Show Expr Source # 
Instance details

Defined in Jikka.Python.Language.Expr

Methods

showsPrec :: Int -> Expr -> ShowS #

show :: Expr -> String #

showList :: [Expr] -> ShowS #

data BoolOp Source #

Constructors

And 
Or 
Implies

our extension

Instances

Instances details
Eq BoolOp Source # 
Instance details

Defined in Jikka.Python.Language.Expr

Methods

(==) :: BoolOp -> BoolOp -> Bool #

(/=) :: BoolOp -> BoolOp -> Bool #

Ord BoolOp Source # 
Instance details

Defined in Jikka.Python.Language.Expr

Read BoolOp Source # 
Instance details

Defined in Jikka.Python.Language.Expr

Show BoolOp Source # 
Instance details

Defined in Jikka.Python.Language.Expr

data Operator Source #

Constructors

Add 
Sub 
Mult 
MatMult 
Div 
FloorDiv 
FloorMod 
CeilDiv

our extension

CeilMod

our extension

Pow 
BitLShift 
BitRShift 
BitOr 
BitXor 
BitAnd 
Max

our extension

Min

our extension

data UnaryOp Source #

Constructors

Invert

on int

Not

on bool

UAdd 
USub 

Instances

Instances details
Eq UnaryOp Source # 
Instance details

Defined in Jikka.Python.Language.Expr

Methods

(==) :: UnaryOp -> UnaryOp -> Bool #

(/=) :: UnaryOp -> UnaryOp -> Bool #

Ord UnaryOp Source # 
Instance details

Defined in Jikka.Python.Language.Expr

Read UnaryOp Source # 
Instance details

Defined in Jikka.Python.Language.Expr

Show UnaryOp Source # 
Instance details

Defined in Jikka.Python.Language.Expr

data CmpOp Source #

Constructors

Eq' 
NotEq 
Lt 
LtE 
Gt 
GtE 
Is 
IsNot 
In 
NotIn 

Instances

Instances details
Eq CmpOp Source # 
Instance details

Defined in Jikka.Python.Language.Expr

Methods

(==) :: CmpOp -> CmpOp -> Bool #

(/=) :: CmpOp -> CmpOp -> Bool #

Ord CmpOp Source # 
Instance details

Defined in Jikka.Python.Language.Expr

Methods

compare :: CmpOp -> CmpOp -> Ordering #

(<) :: CmpOp -> CmpOp -> Bool #

(<=) :: CmpOp -> CmpOp -> Bool #

(>) :: CmpOp -> CmpOp -> Bool #

(>=) :: CmpOp -> CmpOp -> Bool #

max :: CmpOp -> CmpOp -> CmpOp #

min :: CmpOp -> CmpOp -> CmpOp #

Read CmpOp Source # 
Instance details

Defined in Jikka.Python.Language.Expr

Show CmpOp Source # 
Instance details

Defined in Jikka.Python.Language.Expr

Methods

showsPrec :: Int -> CmpOp -> ShowS #

show :: CmpOp -> String #

showList :: [CmpOp] -> ShowS #

type Keyword = (Maybe Ident', Expr') Source #

NULL identifier is for **kwargs.

type Alias = (Ident', Maybe Ident') Source #

(name, asname). Alias is used for Import and ImportFrom.

type WithItem = (Expr', Maybe Expr') Source #

(context_expr, optional_vars)