calcium-lang
Version:
Calcium language interpreter
33 lines (32 loc) • 1.36 kB
TypeScript
/**
* Primitive types in JSON
*/
export declare type Primitive = number | string | boolean | null;
export declare type ArrayLiteral = [unknown[]];
export declare type DictLiteral = {};
/**
* JSON representation of reference expressions in Calcium
*/
export declare type Reference = Attribute | Call | Subscript | Variable;
export declare type Syntax = Comma | KwArg;
/**
* JSON representation of binary operators in Calcium
*/
export declare type BinaryOperation = [
("+" | "-" | "*" | "**" | "/" | "//" | "%" | "==" | "!=" | ">" | ">=" | "<" | "<=" | "and" | "or" | "is" | "is not" | "in" | "not in" | "&" | "|" | "^" | "<<" | ">>"),
Any,
Any
];
export declare type UnaryOperation = ["~" | "-_" | "not", Any];
export declare type Attribute = ["attr", Reference, string];
export declare type Call = ["call", Reference, Any[]];
export declare type Comma = [",", ...Any[]];
export declare type KwArg = ["kwarg", string, Any];
export declare type Subscript = ["sub", Reference, IndexOrKey, SliceEnd?];
export declare type Variable = ["var", string];
export declare type IndexOrKey = number | string | Variable | Attribute;
export declare type SliceEnd = number | Variable;
/**
* any JSON element for Calcium language
*/
export declare type Any = Primitive | ArrayLiteral | DictLiteral | Reference | Syntax | BinaryOperation | UnaryOperation;