9.2. The Syntax

When we had the idea of porting the Processing language to the .NET platform one of the first things that came to our minds was "That's about compilers". In fact we needed to do something with code written in a specified language by the final user. So we began to write a grammar for the Processing language in a free YACC-like C# based tool called Grammatica. But soon we saw that was a lot of work.

Fortunately, after doing a little research in the source code of the original Processing software we saw the approach followed was very different. The idea was to embed the sketch source code in a java class and compile the result with the java compiler. This has some disadvantages, mostly related with not having fine-grained control of the process in which the sketch is executed. But it has one big advantage, the dirty work is done by the underlying compiler (Java Virtual Machine in case of Processing and .NET in case of DotNetProcessing). That permitted developing a working solution in a very short period of time.

This approach had indirectly another advantage. By relaying on the underlaying compiler for the sketch compiling process we can write sketches in different .NET supported syntaxes. A different compiler instance is used for every different syntax supported.

Sketch source code is embedded in the Runner class (C#)


Sketch source code is embedded in the Runner class (VB.NET)



===============================================================================
Generated by the free version of GemDoc. Purchase now at www.gemdoc.net/purchase
DocBook Made Easy - A single source, Windows based, multiple format solution for your document needs.