danm v0.1.4 Danm.WireExpr
WireExpr is expression with width, used in constructing hardware model.
Link to this section Summary
Functions
ast_string(ast, callback) return a string representation of ast. when encounter an id, use the callback for the string generation
return a list of all ids in this expr
parse(str) parse the str orders of operator precedance
width(ast, in: context) return the width of the ast inside the context
if every items has the same width
Link to this section Functions
ast_string(arg1, f)
ast_string(ast, callback) return a string representation of ast. when encounter an id, use the callback for the string generation
ids(arg1)
return a list of all ids in this expr
parse(n)
parse(str) parse the str orders of operator precedance:
- dup (*) extract[::]
- unary operator
- binary operators with 2 chars: == != >= <= && || ^^
- binary operator with single char: +-&|^,>< 5, ?:
The above order is important, so that a && b will be (a && b) not (a & (&b))
width(arg1, list)
width(ast, in: context) return the width of the ast inside the context
width_match?(exprs, list)
if every items has the same width