Niladics and Macros in ::SHE+ILA:: [$51]

Women in Purple Dresses at Outdoor Table Setting
42
0
  • Squishy Plushie's avatar Artist
    Squishy Pl...
  • Prompt
    Read prompt
  • DDG Model
    Artflow
  • Access
    Public
  • Created
    18h ago
  • Try

More about Niladics and Macros in ::SHE+ILA:: [$51]

Now that function calls all require parameters (for readability) so we would have no way of expressing Niladic calls (as in Pascal's "Writeln;"). Also we need a Macro facility so we can write arbitrary text commands such as "Light brand in fire" or "Add A, B giving C". We achieve both these goals by use of ::SHE+ILA:: Macros. Just as functions are declared with "{...}", loops with "{*....*}", threads with "{!...!}", and event handlers with "{?...?}", we declare Macros with "{+...+}".
For example, woo <:: {+ % =>> a =>> b =>> c; c; b; a +};
extracts the next three tokens from the source line and swaps them round, so
woo three two one
would be the same as writing
one two three
We can also put them back in the source line using the insert operator, for example
squish <:: {+ % =>> a << ttyout ("hello") << a +};
inserts the text "ttyout("hello")" as if it had been typed by the user, when it sees the Macro "squish wooee" in the source stream. (Giving "ttyout ("hello") wooee). Note that you can easily write nonsense code :) Macros allow emulation of other languages and command structures, and more readable code. The command interpreter of ::SHE+ILA:: (i.e ::ILA::) may well be written as a set of macros, to allow compilation with MS Visual Studio or Borland C++ for example.

Comments


Loading Dream Comments...

Discover more dreams from this artist