19. Building A Tool-Building Tool With Yacc and Lex

Kaveh Kardan
4 min readMay 4, 2022

--

I would usually have lunch by myself at a small restaurant in Chinatown, which was a few blocks away from the office. I’d carry a copy of “The C++ Programming Language” by Bjarne Stroustrup with me and read it over lunch. I wasn’t convinced by the book’s premise. To me, bolting OO in a static way on C seemed like the wrong approach, and I much preferred the Objective C approach. To this day I am not a fan of C++, finding it difficult to work with. Definitely one of those languages which fights back.

Back from a successful Siggraph, I hunkered down to plan my future development on the system. What would provide the biggest payoff, I asked myself. Daniel was keen on IK (inverse kinematics) which he considered essential for character animation. And that would prove true when the ILM animators used Softimage to animate the dinosaurs in “Jurassic Park”.

But I was thinking bigger, and at a more fundamental level. I had experienced the power of the REPL first-hand when developing my 3D software on the Symbolics Lisp Machine at the MIT Media Lab, and then again with the embedded Neo-Visuals command language. I wanted to build a tool that would let users build their own tools.

That users could save a history of their GUI interactions in an automatically-generated journal file, and be able to customize and automate the workings of the system, seemed like very powerful and desirable features to me. To quote Alan Kay, “Simple things should be simple, complex things should be possible.” Softimage as it currently stood could do simple things well, but there was no way for a user to extend its capabilities.

I brought the idea to Mike Sweeney and he supported it whole heartedly. As a developer he understood the power of scripting in an application.

Ideally, I wanted the “whole system” extensibility of a Symbolics-like package. Mike and I even considered writing a C interpreter for our embedded language, but that was too large an undertaking. Unlike Symbolics’s S-Geometry packages, our user extensions would not be “first class” in that they would not have all the power and scope of the C code written by us as Softimage developers.

So I designed my own stack-based scripting language and wrote a parser for it using Yacc and Lex. It was a Lisp/Smalltalk hybrid and I tested it out by writing a particle system with dynamics and collisions. The particles could animate geometry within the Softimage environment as well as create trails which generated new curve geometries. I recall animating sand flowing through an hourglass.

I have never been a political creature. Not even when it comes to office politics. As far as I knew, everything was going well.

So I thought nothing of it when one afternoon I was called in to the conference room by our new sales manager Richard Szalwinski. Daniel followed us in and closed the door behind him.

“Are you happy here?” Richard asked me.

The rest of the meeting went as you might expect. I showed no emotion, but also didn’t protest. There was little point in doing so. That was the end of my tenure at Softimage. Maybe it was because I had expressed an interest in stock options. I don’t know and speculation in pointless.

There was a tendency by management to discard people no longer thought to be useful. Three out of the four initial developers at the company went through some form of this. In fact, when denied what he had been contractually promised, Mike later took the company to court and prevailed.

Richard left two years later to start Discreet Logic up the street, and he was sued by Daniel.

Within five years, Softimage was sold to Microsoft for a reported $160 million. Over the years, even as the product grew in sophistication thanks to the efforts of talented developers, several of whom I got to know over the years, the company was sold repeatedly, first to Avid and then to Autodesk, which finally shut it down.

Every once in a while I think of the first and only programming language I designed, and how things may have been different if Softimage had had an almost decade-long head start on Maya with its Mel scripting language.

On my walks back from lunch, I would pass by a video game arcade and occasionally pop in to see what was new. One day there was a tile-stacking game playing Russian-sounding music. I had no idea that a decade later, and on the other side of the planet, I would meet and befriend the man substantially responsible for the global success of Tetris.

Design & Code

This code is very much a work in progress.

I decided to write a particle system for generating plant-like structures, to explore how they may differ from the L-systems approach. And to maybe use them for experiments with genetic programming.

I’ve tried to make this class as generalizable as possible, using functions rather than built-in numeric slots with their implied assumptions. So for example the probability of a new spawned branch could depend on any attribute of the parent (life-span, current point location, etc).

For now I am testing this by assigning some sample functions which result in the image above.

And for variety I switched to a black-on-white color scheme, which more closely resembles the display on the Symbolics. Just for fun.

Next Episode

--

--

Kaveh Kardan
Kaveh Kardan

Written by Kaveh Kardan

MIT mathematics degree • wrote animation software used in “Jurassic Park” • software R&D lead on “Final Fantasy” movie • software dev on “The Hobbit” films

No responses yet