links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Last updated at 9:26 pm UTC on 18 July 2022
Class comment:

The compiler accepts Smalltalk source code and compiles it with respect to a given class. The user of the compiler supplies a context so that temporary variables are accessible during compilation.

If there is an error, a requestor (usually a kind of StringHolderController) is sent the message notify:at:in: so that the error message can be displayed.

If there is no error, then the result of compilation is a MethodNode, which is the root of a parse tree whose nodes are kinds of ParseNodes.

The parse tree can be sent messages to
(1) generate code for a CompiledMethod (this is done for compiling methods or evaluating expressions);
(2) pretty-print the code (for formatting); or
(3) produce a map from object code back to source code (used by debugger program-counter selection).

See also Parser, Encoder, ParseNode.

 Compiler evaluate: '1+2'  3

Pharo equivalent:

 Smalltalk compiler evaluate: '1+2'

Example to generate a method using #compile: see
Editing CustomHelp topics



	"Answer a parser class to use for parsing methods compiled by instances of the receiver."