feat: expose parser in argus
This commit is contained in:
parent
50d5a0a78a
commit
f97d593926
7 changed files with 241 additions and 66 deletions
|
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||
from typing import List, Optional, Tuple, Type, Union
|
||||
|
||||
from . import _argus
|
||||
from ._argus import dtype
|
||||
from ._argus import dtype, parse_expr
|
||||
from .exprs import ConstBool, ConstFloat, ConstInt, ConstUInt, VarBool, VarFloat, VarInt, VarUInt
|
||||
from .signals import BoolSignal, FloatSignal, IntSignal, Signal, UnsignedIntSignal
|
||||
|
||||
|
|
@ -87,6 +87,7 @@ def signal(
|
|||
|
||||
__all__ = [
|
||||
"dtype",
|
||||
"parse_expr",
|
||||
"declare_var",
|
||||
"literal",
|
||||
"signal",
|
||||
|
|
|
|||
|
|
@ -1,8 +1,12 @@
|
|||
from typing import ClassVar, Literal, Protocol, TypeAlias, final
|
||||
from typing import ClassVar, Literal, TypeAlias, final
|
||||
|
||||
from typing_extensions import Self
|
||||
|
||||
class NumExpr(Protocol):
|
||||
def parse_expr(expr_str: str) -> Expr: ...
|
||||
|
||||
class Expr: ...
|
||||
|
||||
class NumExpr(Expr):
|
||||
def __ge__(self, other: Self) -> NumExpr: ...
|
||||
def __gt__(self, other: Self) -> NumExpr: ...
|
||||
def __le__(self, other: Self) -> NumExpr: ...
|
||||
|
|
@ -64,7 +68,7 @@ class Div(NumExpr):
|
|||
class Abs(NumExpr):
|
||||
def __init__(self, arg: NumExpr) -> None: ...
|
||||
|
||||
class BoolExpr(Protocol):
|
||||
class BoolExpr(Expr):
|
||||
def __and__(self, other: Self) -> BoolExpr: ...
|
||||
def __invert__(self) -> BoolExpr: ...
|
||||
def __or__(self, other: Self) -> BoolExpr: ...
|
||||
|
|
@ -192,5 +196,9 @@ class FloatSignal(Signal):
|
|||
@final
|
||||
class Trace: ...
|
||||
|
||||
def eval_bool_semantics(expr: BoolExpr, trace: Trace) -> BoolSignal: ...
|
||||
def eval_robust_semantics(expr: BoolExpr, trace: Trace) -> BoolSignal: ...
|
||||
def eval_bool_semantics(
|
||||
expr: BoolExpr, trace: Trace, *, interpolation_method: _InterpolationMethod = "linear"
|
||||
) -> BoolSignal: ...
|
||||
def eval_robust_semantics(
|
||||
expr: BoolExpr, trace: Trace, *, interpolation_method: _InterpolationMethod = "linear"
|
||||
) -> BoolSignal: ...
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ from argus._argus import (
|
|||
ConstUInt,
|
||||
Div,
|
||||
Eventually,
|
||||
Expr,
|
||||
Mul,
|
||||
Negate,
|
||||
Next,
|
||||
|
|
@ -46,4 +47,7 @@ __all__ = [
|
|||
"VarFloat",
|
||||
"VarInt",
|
||||
"VarUInt",
|
||||
"Expr",
|
||||
"BoolExpr",
|
||||
"NumExpr",
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue