module documentation

Fortran/C symbolic expressions

References: - J3/21-007: Draft Fortran 202x. https://j3-fortran.org/doc/year/21/21-007.pdf

Constant COUNTER Undocumented
Variable integer​_types Undocumented
Variable number​_types Undocumented
Class _​From​String​Worker No class docstring; 0/3 instance variable, 1/4 method documented
Class _​Pair Undocumented
Class ​Arith​Op Used in Op.APPLY expression to specify the function part.
Class ​Expr Represents a Fortran expression as a op-data pair.
Class ​Expr​Warning Undocumented
Class ​Language Used as Expr.tostring language argument.
Class ​Op Used as Expr op attribute.
Class ​Op​Error Undocumented
Class ​Precedence Used as Expr.tostring precedence argument.
Class ​Rel​Op Used in Op.RELATIONAL expression to specify the function part.
Function ​_counter Undocumented
Function ​_get​_parenthesis​_kind Undocumented
Function ​_pairs​_add Undocumented
Function as​_apply Return object as APPLY expression (function call, constructor, etc.)
Function as​_array Return object as ARRAY expression (array constant).
Function as​_complex Return object as COMPLEX expression (complex literal constant).
Function as​_deref Return object as dereferencing expression.
Function as​_eq Undocumented
Function as​_expr Convert non-Expr objects to Expr objects.
Function as​_factors Return expression as FACTORS expression.
Function as​_ge Undocumented
Function as​_gt Undocumented
Function as​_integer Return object as INTEGER constant.
Function as​_le Undocumented
Function as​_lt Undocumented
Function as​_ne Undocumented
Function as​_number Return object as INTEGER or REAL constant.
Function as​_numer​_denom Return expression as numer-denom pair.
Function as​_real Return object as REAL constant.
Function as​_ref Return object as referencing expression.
Function as​_string Return object as STRING expression (string literal constant).
Function as​_symbol Return object as SYMBOL expression (variable or unparsed expression).
Function as​_term​_coeff Return expression as term-coefficient pair.
Function as​_terms Return expression as TERMS expression.
Function as​_ternary Return object as TERNARY expression (cond?expr1:expr2).
Function eliminate​_quotes Replace quoted substrings of input string.
Function ewarn Undocumented
Function fromstring Create an expression from a string.
Function insert​_quotes Inverse of eliminate_quotes.
Function normalize Normalize Expr and apply basic evaluation methods.
Function replace​_parenthesis Replace substrings of input that are enclosed in parenthesis.
Function unreplace​_parenthesis Inverse of replace_parenthesis.
COUNTER =

Undocumented

Value
_counter()
integer_types =

Undocumented

number_types =

Undocumented

def _counter():

Undocumented

def _get_parenthesis_kind(s):

Undocumented

def _pairs_add(d, k, v):

Undocumented

def as_apply(func, *args, **kwargs):
Return object as APPLY expression (function call, constructor, etc.)
def as_array(obj):
Return object as ARRAY expression (array constant).
def as_complex(real, imag=0):
Return object as COMPLEX expression (complex literal constant).
def as_deref(expr):
Return object as dereferencing expression.
def as_eq(left, right):

Undocumented

def as_expr(obj):
Convert non-Expr objects to Expr objects.
def as_factors(obj):
Return expression as FACTORS expression.
def as_ge(left, right):

Undocumented

def as_gt(left, right):

Undocumented

def as_integer(obj, kind=4):
Return object as INTEGER constant.
def as_le(left, right):

Undocumented

def as_lt(left, right):

Undocumented

def as_ne(left, right):

Undocumented

def as_number(obj, kind=4):
Return object as INTEGER or REAL constant.
def as_numer_denom(obj):
Return expression as numer-denom pair.
def as_real(obj, kind=4):
Return object as REAL constant.
def as_ref(expr):
Return object as referencing expression.
def as_string(obj, kind=1):
Return object as STRING expression (string literal constant).
def as_symbol(obj):
Return object as SYMBOL expression (variable or unparsed expression).
def as_term_coeff(obj):
Return expression as term-coefficient pair.
def as_terms(obj):
Return expression as TERMS expression.
def as_ternary(cond, expr1, expr2):
Return object as TERNARY expression (cond?expr1:expr2).
def eliminate_quotes(s):

Replace quoted substrings of input string.

Return a new string and a mapping of replacements.

def ewarn(message):

Undocumented

def fromstring(s, language=Language.C):

Create an expression from a string.

This is a "lazy" parser, that is, only arithmetic operations are resolved, non-arithmetic operations are treated as symbols.

def insert_quotes(s, d):
Inverse of eliminate_quotes.
def normalize(obj):
Normalize Expr and apply basic evaluation methods.
def replace_parenthesis(s):

Replace substrings of input that are enclosed in parenthesis.

Return a new string and a mapping of replacements.

def unreplace_parenthesis(s, d):
Inverse of replace_parenthesis.