Crosscut

Daily Thought - 2024-11-16

Hey, I'm Hanno! These are my daily thoughts on Crosscut, the programming language I'm creating. If you have any questions, comments, or feedback, please get in touch!

This thought was published before Crosscut was called Crosscut! If it refers to "Caterpillar", that is the old name, just so you know.

< back to list

The host in Caterpillar embeds the runtime, providing platform-specific capabilities. Right now, the runtime is a bytecode interpreter. The host is an application that runs this interpreter. The host I'm currently working on (the game engine) is specifically a web application, but other hosts could be running on Linux/Windows/macOS, microcontrollers, whatever.

But the host does not only exist at runtime. It's also a compile-time concept. The compiler is not tied to a specific host, but it can query the current one over a generic interface. Using that interface, it can determine whether a given identifier in the code refers to a host function, and generate code accordingly.

This is just the current state. At some point, I want to compile Caterpillar to WebAssembly and native machine code. Then the host could turn into a concept that only exists at compile-time. You don't really need a runtime component that executes a host function, if you can instead teach the compiler to generate code that does the same thing.

<< previous thoughtnext thought >>

Hey, you! Want to subscribe to my daily thoughts? Just let me know (maybe include a nice message, if you're up for it), and I'll send you an email whenever I post a new one.