Why convert LOBSTER to CPP?
Developers convert Lobster source to .cpp to squeeze out extra speed for a release build, since compiled C++ runs faster than Lobster's JIT. The generated C++ is self-contained and drops into Lobster's normal build setup in place of the standard main.cpp.
How to convert LOBSTER to CPP
Lobster (--cpp) OPEN-SOURCE
From the repo root run bin/lobster --cpp yourpath/my.lobster, which writes dev/compiled_lobster/src/compiled_lobster.cpp containing a full main().
Lobster + CMake build OPEN-SOURCE
Build the C++ output automatically with cmake -DLOBSTER_TOCPP=ON -DCMAKE_BUILD_TYPE=Release . then make -j8, which substitutes the generated file and produces a native executable.
About these formats
A .lobster file holds source code written in the Lobster programming language, a statically typed language with Python-like indentation created by Wouter van Oortmerssen and aimed mainly at…
Open .LOBSTER details →A CPP file is plain-text C++ source code - the human-written instructions that a compiler turns into a runnable program. Open it in any code editor (VS Code, Notepad++, Xcode) to read or…
Open .CPP details →Quality & what to watch
- The generated
.cppis machine-produced and not meant to be read or hand-edited - it is an intermediate build artifact. - You still need Lobster's own headers and build files to compile it; the file is not a standalone program you can drop into an unrelated C++ project.
- The official docs recommend
--cpponly for shipping builds, not during development, because the JIT is faster to iterate on.
Frequently asked questions
Where does the .cpp file get written?
dev/compiled_lobster/src/compiled_lobster.cpp when you run --cpp from the root of the Lobster repo.Can I compile the .cpp without the Lobster repo?
main.cpp using Lobster's provided build setup.