[sdiy] Programming Language of choice

Gordonjcp gordonjcp at gjcp.net
Mon Feb 29 09:50:10 CET 2016


On Sun, Feb 28, 2016 at 09:13:18PM +0000, Chris Juried wrote:
> Hi Tom,
> That was my speculation as well. I have heard of others integrating Python scripts into their C code. Does that make sense? Sincerely,   
>   Chris Juried  

Not quite but you can write C code and give it Python bindings.  That lets you d speed-critical stuff in C but then use it just like any other Python functions - I did this for my software-defined radio project, although I never got the Python bindings into a state where I was happy to show it to the general public.

There's also Lua, which was pretty much designed to be used as an embedded scrpting language within a larger program.  That finds a lot of use in video games where the game engine is written in a language like C or C++ and the actual functionality is scripted in Lua.  You can even get a compiler to turn Lua into "progs.dat" for Quake, replacing the QuakeC gameplay library with one re-written by clever people in Lua.

For fast stuff like audio processing, C or assembler is pretty much the only way.  C++ is not a good fit for microcontrollers, even large ones - it's fine in PCs where you have infinite RAM and disk storage.  The largest microcontrollers have maybe a few hundred kilobytes of RAM, but modern PCs have as much as a few hundred *megabytes* of RAM, or even more ;-)

If, on the other hand, you want to learn something new for the fun of it, you should look at how Forth works, possibly by looking at JonesForth which runs on a PC.  There you've got a complete high-level language that is completely self-hosting once you've written about a dozen "words" comprising a couple of kilobytes of assembler - small enough to write and assemble by hand.  A lot of old Sun kit used Forth as part of the OpenBoot bootloader because it was so ridiculously easy to get it working on SPARC processors.  Anything that lets you implement two stacks and has a fairly quick indexed addressing mode ought to do it.  The 6809 CPU is another chip that's remarkably suitable for Forth, as is the PDP11 and 68000.

-- 
Gordonjcp MM0YEQ



More information about the Synth-diy mailing list