Half-time for Parser

I’m halfway through with my first pass of the Parser class – only parsing of options, variables, and expressions is missing. I’ll try to get the full parsing to work first because then I can easily test it with many examples before moving on to rendering graphics and evaluating expressions.

I saw quite a few things that I didn’t remember about the applet. For example, the support for arrays of constant numbers. I remember that this was motivated by the problem of using variables as indices. As far as I remember, these arrays make it possible to use variables as indices for arrays of constant numbers – even multidimensional arrays. However, I think I never tested it sufficiently and therefore it is not documented.

Also, I forgot about “If”s around graphics primitives. Basically, all geometric primitives always exists but based on the values of the “If” conditions around them, primitives are activated or deactivated. I had forgotten how awkward this part of the code is.

Actually, the code of the Parser class feels quite awkward in general. It probably would have been much better first to build up a hierarchical data structure representing a general Mathematica expression during the parsing and only then to process the data structure based on the “Head“s of the nodes.

Hindsight is a wonderful thing.