martinmcclure / mist

Filetree code for the Mist project (mist-project.org)
32 stars 5 forks source link

Primitive methods #16

Open martinmcclure opened 11 years ago

martinmcclure commented 11 years ago

Right now, the back end of the Mist compiler is successfully turning Fog into a short executable program. There are no objects, classes, methods, or even subroutines.

The next step is to produce an ELF file with two objects in it, a startup routine and a method. The method will be a primitive. The startup routine will be one that starts Mist by initializing the stack pointer and calling the designated startup method. When (if) that method returns, the startup routine will check to see whether it returned a SmallInteger in the C int range. If it did, that will be the exit status of Mist. Otherwise, the exit status will be 1.

For the primitive, I'll probably convert each of the existing Fog tests to produce a primitive method, at which point the existing Program node will be obsolete and can be retired.

martinmcclure commented 11 years ago

If the startup method does not answer a SmallInteger, perhaps the exit status should be 70. From sysexits.h:

define EX_SOFTWARE 70 /* internal software error */

None of the other predefined ones look appropriate.