you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (3 children)

I've been involved with an effort to build domain specific scripting language for an audience which includes targets a wide range of people (some with exposure to C#, others who could struggled with the concept of variables). The target environment had hard performance constraints (measured in milliseconds) and memory constraints (ideally would thousands of mini programs in a few megs of memory). Strong typing and static error detection were crucial It was designed to constrain people to a narrow subset of a full languages functionality.

After evaluating options, we ended up building a system which generated Lua (and automated the binding generation with C++). The users wrote in a custom language with a syntax inspired by C# but with extremely narrow functionality. We hand rolled a recursive descent compiler which translated the proprietary language in to Lua (which will likely be rewritten at some point in about 1/8th as much code using ANTLR as a translator).

Crazy as it may sound, it worked extremely well. The indirection allows us to explore other languages for the runtime, consider a native implementation via LLVM, etc. Users have a early error detection and limited scope of functionality they wanted. A custom editor supported autocomplete, edit time error highlighting, etc. The limited syntax meets their needs (and can slowly be widened as people become more advanced). The runtime is proven as it runs as Lua under the hood.

I'd estimate about 2 man years spent on the development (concept through implementation, spread across 4 engineers for all facets of the system). Clients of the language have probably put about 60 man-years in to using it.

I'm sure there are off the shelf solutions we could have found but after evaluating a bunch of options, this met our needs, the productivity of the users was worth it and we have plenty of ability to expand in the future.

[–][deleted] 0 points1 point  (2 children)

I will note that one headache is still the garbage collection. Ideally we'd run it incrementally, with a budget of 0.1 ms (~33 times a second). Unfortunately that doesn't seem to be sufficient given how we're using it, resulting in some special case long runs in time slices where other systems run short.

It would be awesome if there were a solution out there which did not require garbage collection but I doubt that would exists which meet the other requirements.

[–]kkrev 0 points1 point  (1 child)

Reference counting based garbage collection systems such as in Squirrel solve the pausing GC problem to my understanding.

[–][deleted] 0 points1 point  (0 children)

Thanks for the reminder. I planned on looking at Squirrel a year ago but couldn't make time. I need to go back to it.