module documentation

Fortran/C symbolic expressions

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

Class ArithOp Used in Op.APPLY expression to specify the function part.
Class Expr Represents a Fortran expression as a op-data pair.
Class Language Used as Expr.tostring language argument.
Class Op Used as Expr op attribute.
Class Precedence Used as Expr.tostring precedence argument.
Class RelOp Used in Op.RELATIONAL expression to specify the function part.
Exception ExprWarning Undocumented
Exception OpError 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.
Constant COUNTER Undocumented
Variable integer_types Undocumented
Variable number_types Undocumented
Class _FromStringWorker No class docstring; 0/3 instance variable, 1/4 method documented
Class _Pair Undocumented
Function _counter Undocumented
Function _get_parenthesis_kind Undocumented
Function _pairs_add Undocumented
def as_apply(func, *args, **kwargs): (source)

Return object as APPLY expression (function call, constructor, etc.)

def as_array(obj): (source)

Return object as ARRAY expression (array constant).

def as_complex(real, imag=0): (source)

Return object as COMPLEX expression (complex literal constant).

def as_deref(expr): (source)

Return object as dereferencing expression.

def as_eq(left, right): (source)

Undocumented

def as_expr(obj): (source)

Convert non-Expr objects to Expr objects.

def as_factors(obj): (source)

Return expression as FACTORS expression.

def as_ge(left, right): (source)

Undocumented

def as_gt(left, right): (source)

Undocumented

def as_integer(obj, kind=4): (source)

Return object as INTEGER constant.

def as_le(left, right): (source)

Undocumented

def as_lt(left, right): (source)

Undocumented

def as_ne(left, right): (source)

Undocumented

def as_number(obj, kind=4): (source)

Return object as INTEGER or REAL constant.

def as_numer_denom(obj): (source)

Return expression as numer-denom pair.

def as_real(obj, kind=4): (source)

Return object as REAL constant.

def as_ref(expr): (source)

Return object as referencing expression.

def as_string(obj, kind=1): (source)

Return object as STRING expression (string literal constant).

def as_symbol(obj): (source)

Return object as SYMBOL expression (variable or unparsed expression).

def as_term_coeff(obj): (source)

Return expression as term-coefficient pair.

def as_terms(obj): (source)

Return expression as TERMS expression.

def as_ternary(cond, expr1, expr2): (source)

Return object as TERNARY expression (cond?expr1:expr2).

def eliminate_quotes(s): (source)

Replace quoted substrings of input string.

Return a new string and a mapping of replacements.

def ewarn(message): (source)

Undocumented

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

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): (source)

Inverse of eliminate_quotes.

def normalize(obj): (source)

Normalize Expr and apply basic evaluation methods.

def replace_parenthesis(s): (source)

Replace substrings of input that are enclosed in parenthesis.

Return a new string and a mapping of replacements.

def unreplace_parenthesis(s, d): (source)

Inverse of replace_parenthesis.

Undocumented

Value
_counter()
integer_types = (source)

Undocumented

number_types = (source)

Undocumented

def _counter(): (source)

Undocumented

def _get_parenthesis_kind(s): (source)

Undocumented

def _pairs_add(d, k, v): (source)

Undocumented