I'm looking for a scripting engine to embed in a C program. Here's what I'm looking for in it:

  • FOSS (doesn't matter whether it's a copyleft or pushover license)
  • C interop (though I expect every scripting engine to support this, so this doesn't really narrow it down)
  • Lightweight (not hundreds of MB)
  • Cross-platform (at a minimum, should build on Windows, macOS, and Linux systems and x86-64 and AArch64 architectures without needing to jump through any crazy hoops)
  • Good support for a functional programming paradigm
  • Strongly and statically typed, ideally with a Haskell/ML-style type system
  • Bonus: It would be nice if it were pure like Haskell or PureScript

Lua's type system is basically nonexistent (every non-primitive type is an array/map hybrid called a "table"), so it's out. GHC is a gigantic monstrosity (hundreds of MB), so it's out too.

  • 1
    Would JavaScript + TypeScript work? I'm just not sure about C interop. – dwjohnston Jan 2 '20 at 6:34
  • What about Julia? (Never done it) – knb Jan 2 '20 at 10:41
  • @dwjohnston That seems like it might be an okay language (even though JS sure has its warts...) but which engine fits the bill? Neither SpiderMonkey nor V8 seem exactly lightweight. – Joseph Sible-Reinstate Monica Jan 5 '20 at 23:58
  • Not strongly typed, but TCL is another contender in the Lua class. – jrw32982 Jan 7 '20 at 20:20
  • I think Lua is popular for this sort of thing. – Eric S Nov 23 '20 at 10:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.