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

Link to this function

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

return a list of all ids in this expr

parse(str) parse the str orders of operator precedance:

  1. dup (*) extract[::]
  2. unary operator
  3. binary operators with 2 chars: == != >= <= && || ^^
  4. binary operator with single char: +-&|^,>< 5, ?:

The above order is important, so that a && b will be (a && b) not (a & (&b))

Link to this function

width(arg1, list)

width(ast, in: context) return the width of the ast inside the context

Link to this function

width_match?(exprs, list)

if every items has the same width