2007-09-20 18:09:08 -04:00
USING: help.markup help.syntax kernel generic
math hashtables quotations classes continuations ;
IN: tools.interpreter
2007-10-04 18:45:19 -04:00
ARTICLE: "meta-interpreter" "Meta-circular interpreter"
"The meta-circular interpreter is used to implement the walker tool in the UI. If you are simply interested in single stepping through a piece of code, use the " { $link "ui-walker" } "."
$nl
"On the other hand, if you want to implement a similar tool yourself, then you can use the words described in this section."
$nl
"Meta-circular interpreter words are found in the " { $vocab-link "tools.interpreter" } " vocabulary."
$nl
2007-09-20 18:09:08 -04:00
"Breakpoints can be inserted in user code:"
{ $subsection break }
"Breakpoints invoke a hook:"
{ $subsection break-hook }
"Single stepping with the meta-circular interpreter:"
{ $subsection step }
2007-10-03 16:56:49 -04:00
{ $subsection step-into }
2007-09-20 18:09:08 -04:00
{ $subsection step-out }
2007-10-03 16:56:49 -04:00
{ $subsection step-all } ;
2007-09-20 18:09:08 -04:00
ABOUT: "meta-interpreter"
2007-10-03 16:56:49 -04:00
HELP: interpreter
2007-10-04 18:45:19 -04:00
{ $class-description "An interpreter instance." } ;
2007-09-20 18:09:08 -04:00
HELP: step
2007-10-04 18:45:19 -04:00
{ $values { "interpreter" interpreter } }
2007-09-20 18:09:08 -04:00
{ $description "Evaluates the object in the single stepper using Factor evaluation semantics:"
{ $list
{ "If the object is a " { $link wrapper } ", then the wrapped object is pushed on the single stepper's data stack" }
{ "If the object is a word, then the word is executed in the single stepper's continuation atomically" }
{ "Otherwise, the object is pushed on the single stepper's data stack" }
}
} ;
2007-10-03 16:56:49 -04:00
HELP: step-into
2007-10-04 18:45:19 -04:00
{ $values { "interpreter" interpreter } }
2007-09-20 18:09:08 -04:00
{ $description "Evaluates the object in the single stepper using Factor evaluation semantics:"
{ $list
{ "If the object is a " { $link wrapper } ", then the wrapped object is pushed on the single stepper's data stack" }
{ "If the object is a compound word, then the single stepper enters the word definition" }
{ "If the object is a primitive word or a word with special single stepper behavior, it is executed in the single stepper's continuation atomically" }
{ "Otherwise, the object is pushed on the single stepper's data stack" }
}
} ;
HELP: step-out
2007-10-04 18:45:19 -04:00
{ $values { "interpreter" interpreter } }
2007-09-20 18:09:08 -04:00
{ $description "Evaluates the remainder of the current quotation in the single stepper." } ;
HELP: step-all
2007-10-04 18:45:19 -04:00
{ $values { "interpreter" interpreter } }
2007-09-20 18:09:08 -04:00
{ $description "Executes the remainder of the single stepper's continuation. This effectively ends single stepping unless the continuation invokes " { $link break } " at a later point in time." } ;