Class: Sexpir::Circuit
- Defined in:
- lib/sexpir/ast.rb,
lib/sexpir/ast_sexp.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#inputs ⇒ Object
Returns the value of attribute inputs.
-
#name ⇒ Object
Returns the value of attribute name.
-
#outputs ⇒ Object
Returns the value of attribute outputs.
-
#signals ⇒ Object
Returns the value of attribute signals.
Attributes inherited from Ast
Instance Method Summary collapse
-
#initialize ⇒ Circuit
constructor
A new instance of Circuit.
- #sexp ⇒ Object
Methods inherited from Ast
Constructor Details
#initialize ⇒ Circuit
12 13 14 15 16 |
# File 'lib/sexpir/ast.rb', line 12 def initialize @signals=[] @inputs,@outputs=[],[] @body=Body.new end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
11 12 13 |
# File 'lib/sexpir/ast.rb', line 11 def body @body end |
#inputs ⇒ Object
Returns the value of attribute inputs.
11 12 13 |
# File 'lib/sexpir/ast.rb', line 11 def inputs @inputs end |
#name ⇒ Object
Returns the value of attribute name.
11 12 13 |
# File 'lib/sexpir/ast.rb', line 11 def name @name end |
#outputs ⇒ Object
Returns the value of attribute outputs.
11 12 13 |
# File 'lib/sexpir/ast.rb', line 11 def outputs @outputs end |
#signals ⇒ Object
Returns the value of attribute signals.
11 12 13 |
# File 'lib/sexpir/ast.rb', line 11 def signals @signals end |
Instance Method Details
#sexp ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/sexpir/ast_sexp.rb', line 17 def sexp code=Code.new code << "(circuit #{name}" code.indent=2 signals.each{|sig| code << sig.sexp} inputs.each{|input | code << input.sexp} outputs.each{|output| code << output.sexp} code.newline code << body.sexp code.indent=0 code << ")" code.finalize end |