I need to extend the Charme interpreter (described here) by adding a primitive procedure <= to the global environment. I know that to do this I also need to define a procedure that implements the primitive, and modify initializeGlobalEnvironment
to install the primitive.
This is what I have for initializeGlobalEnvironment
--
def initializeGlobalEnvironment():
global globalEnvironment
globalEnvironment = Environment(None)
globalEnvironment.addVariable('true', True)
globalEnvironment.addVariable('false', False)
globalEnvironment.addVariable('+', primitivePlus)
globalEnvironment.addVariable('-', primitiveMinus)
globalEnvironment.addVariable('*', primitiveTimes)
globalEnvironment.addVariable('=', primitiveEquals)
globalEnvironment.addVariable('zero?', primitiveZero)
globalEnvironment.addVariable('>', primitiveGreater)
globalEnvironment.addVariable('<', primitiveLessThan)