r/ProgrammingLanguages • • Apr 11 '23

Functional bytecode

I'm interested in whether work has been done to create a bytecode that is less imperative and more of a functional style. My hunch is such a bytecode may be more amenable to fast interpretation, since stuff like loops may be dispatched more directly to native code (instead of individual flow control ops). Has anyone seen anything like this? How annoying would it be for traditional languages to get translated into such a bytecode (does it require vectorization?)?

62 Upvotes

23 comments sorted by

View all comments

Show parent comment

3

u/thmprover Apr 12 '23

As far as I can tell, STG and similar approaches are more appropriate as IRs for non-strict functional languages. I imagine a compiler could go through STG to output some portable bytecode.

Correction: ZINC, CAM, FAM, and friends are suitable for strict functional programming languages. The STG, G-machine, Krivine machine, and friends, are more suitable for lazy functional programming languages.