jamesladd / stc

stc
Other
3 stars 2 forks source link

ByteCodeEmitter needs to emit a class' bytecode. #2

Closed jamesladd closed 6 years ago

jamesladd commented 6 years ago

Branch to commit work to: jcl/emit-class

The ByteCodeEmitter is currently empty.

The ByteCodeEmitter class needs to emit bytecode for a Java Class which when constructed you can call sendMessages() on.

sendMessages(Smalltalk smalltalk) will invoke all the message sends contained within the generated class to carry out the instructions contained in the generated class. The message sends within the class may be a script (not create a new subclass) or messages to create a new subclass and add the associated methods to it.

An example Smalltalk class that does create a class is below:

Object subclass: #Test.

This is the same file after pre-processing (Note the instance and class method declarations have been expanded into the corresponding message sends:

Object subclass: #Test.

Test basicAddSelector: #instanceMethod withMethod: [ ^ self. ]. Test class basicAddSelector: #classMethod withMethod: [ ^ self. ].

jamesladd commented 6 years ago

jcl/emit-class has been implemented and merged to master. Currently this can only be run using the IDE. Set the working directory to ./target/classes Set program arguments to: st.redline.example.Test Set main class to: st.redline.Stic