Language ExtensionLanguage Extension mk Tue, 04/28/2020 - 19:24
8.12 Language Extensions
Iterators over scalar ranges are often needed, also at the MAL level. The barrier and control primitives are sufficient to mimic them directly.
The modules located in the kernel directory should not rely on the MAL datastructures. That's why we have to deal with some bat operations here and delegate the signature to the proper module upon loading.
Running a script is typically used to initialize a context. Therefore we need access to the runtime context. For the call variants we have to determine an easy way to exchange the parameter/return values.
- module language;
- pattern call(s:str):void
address CMDcallString comment "Evaluate a MAL string program.";
address CMDcallBAT comment "Evaluate a program stored in a BAT.";
address CMDevalFile comment "Merge the instructions stored in the file with the current program.";
command raise(msg:str) :str
comment "Raise an exception labeled
with a specific message.";
comment "Assertion test.";
comment "The current guarded block is executed using dataflow control. ";
comment "Variables to be considered together when triggering garbage collection.
Used in the dataflow blocks to avoid early release of values.";
comment "Cheap instruction to disgard storage while retaining the dataflow dependency";
comment"Compile the code string to MAL and register it as a function.";