Prexonite Script

a .NET hosted scripting language with a focus on meta-programming and embedded DSLs

View the Project on GitHub SealedSun/prx

Fancy Beer

Posted on 2007-01-26

I'm close to reaching my first milestone: Support for all common language constructs. What do I mean by "common"? The minimum requirements for the language to be useful if you want.

With the recent addition of commands, the virtual machine is now complete and waits for the compiler and type system to catch up.The foreachloop is ready to be used and accepts both Prexonite Lists (mixed values) and pure CLI IEnumerables. Also built into my current version is support for global code\* and build blocks\*\*.

Global code

Allows you to initialize (and re-initialize) global variables. Those instructions are executed the next time a function is run.

Build block

Introduced by the buildkeyword. It gives you control over the loader at compile time. You can use the special commands Add and Require to load additional files into the current application. (Require only loads a file if it hasn't been loaded before.)

Prexonite, interactive beer session

Here I first compiled the script samples\\beer_fancy.pxs into the file beer.pxs, then loaded that file in an interactive session and finally executed the song function with a custom argument. All text output is exclusively generated by Prexonite code. (Yes, this also includes the interactive interface).