Kaynağa Gözat

ASTInterpreter class comment

Nicolas Petton 10 yıl önce
ebeveyn
işleme
9d993db63b
2 değiştirilmiş dosya ile 14 ekleme ve 0 silme
  1. 1 0
      js/Compiler-Interpreter.js
  2. 13 0
      st/Compiler-Interpreter.st

+ 1 - 0
js/Compiler-Interpreter.js

@@ -1205,6 +1205,7 @@ smalltalk.ASTDebugger.klass);
 
 
 smalltalk.addClass('ASTInterpreter', smalltalk.NodeVisitor, ['node', 'context', 'stack', 'returnValue', 'returned'], 'Compiler-Interpreter');
+smalltalk.ASTInterpreter.comment="I visit an AST, interpreting (evaluating) nodes one after the other, using a small stack machine.\x0a\x0a## API\x0a\x0aWhile my instances should be used from within an `ASTDebugger`, which provides a more high level interface,\x0ayou can use methods from the `interpreting` protocol:\x0a\x0a- `#step` evaluates the current `node` only\x0a- `#stepOver` evaluates the AST from the current `node` up to the next stepping node (most likely the next send node)\x0a- `#proceed` evaluates eagerly the AST\x0a- `#restart` select the first node of the AST\x0a- `#skip` skips the current node, moving to the next one if any";
 smalltalk.addMethod(
 smalltalk.method({
 selector: "assign:to:",

+ 13 - 0
st/Compiler-Interpreter.st

@@ -415,6 +415,19 @@ context: aContext
 NodeVisitor subclass: #ASTInterpreter
 	instanceVariableNames: 'node context stack returnValue returned'
 	package: 'Compiler-Interpreter'!
+!ASTInterpreter commentStamp!
+I visit an AST, interpreting (evaluating) nodes one after the other, using a small stack machine.
+
+## API
+
+While my instances should be used from within an `ASTDebugger`, which provides a more high level interface,
+you can use methods from the `interpreting` protocol:
+
+- `#step` evaluates the current `node` only
+- `#stepOver` evaluates the AST from the current `node` up to the next stepping node (most likely the next send node)
+- `#proceed` evaluates eagerly the AST
+- `#restart` select the first node of the AST
+- `#skip` skips the current node, moving to the next one if any!
 
 !ASTInterpreter methodsFor: 'accessing'!