Module erg_parser::ast
source · Expand description
defines Expr
(Expression, the minimum executing unit of Erg).
Structs
- Application ex.
Vec Int
ofOption Vec Int
- e.g.
Data::{x = 1; y = 2}
- デコレータは関数を返す関数オブジェクトならば何でも指定できる e.g. @(x -> x)
- Once the default_value is set to Some, all subsequent values must be Some
- リテラルに実際の値が格納された構造体(定数畳み込み用) ArrayやDictはまた別に
- e.g.
- Record can be defined with shorthend/normal mixed style, i.e. {x; y=expr; z; …}
- Once the default_value is set to Some, all subsequent values must be Some
- This is not necessary for Erg syntax, but necessary for mapping ASTs in Python
- 引数を取るならTypeでもSubr扱い
- e.g. obj.0, obj.1
- f|T := Int|
- type_ascription ::= expr ‘:’ type | expr ‘<:’ type | expr ‘:>’ type
- symbol as a left value
Enums
- valid expression for an argument of polymorphic types 多相型の実引数として有効な式
- Expression(式)
- Some Erg functions require additional operation by the compiler.
- 関数定義や無名関数で使えるパターン
- represents a declaration of a variable
- Array:
[Int; 3]
,[Int, Ratio, Complex]
, etc.Dict:[Str: Str]
, etc.And (Intersection type): Add and Sub and Mul (== Num), etc.Not (Diff type): Pos == Nat not {0}, etc.Or (Union type): Int or None (== Option Int), etc.Enum:{0, 1}
(== Binary), etc.Range: 1..12, 0.0<..1.0, etc.Record: {.into_s: Self.() -> Str }, etc.Subr: Int -> Int, Int => None, T.(X) -> Int, etc.TypeApp: F|…|