Hello world/Newbie
Zen C is a modern systems programming language that compiles to human-readable GNU C/C.
Docs and the like can be found on it's [https://github.com/zenc-lang/zenc github] page.
Supported Platforms and Backends
The Zen C compiler, zc, has support for Windows, macOS and Linux. As it is a transpiler (a source-to-source compiler), it acts as a front-end, requiring a back-end. Some of the available backends are gcc, clang, tcc, zig cc. The list is not exhaustive. By default, gcc will be used, but you can specify the back-end with the --cc flag.
Installation
Compile from source
git clone https://github.com/zenc-lang/zenc.git
cd Zen-C
make clean # remove old build files
make
sudo make install
If you are on Windows you can build using the provided batch script, build.bat.
Example
fn main() {
// In Zen C, I/O is not handled like in C. While 'printf' or 'puts'
// among others are still available, Zen C also has special keywords,
// like 'println' or 'print' (stdout) and 'eprintln' or 'eprint' (stderr).
// Each one of these keywords also has an implicit form.
// -> "..." is the same as println "..."
// -> "...".. is the same as print "..."
// -> !"..." is the same as eprintln "..."
// -> !"...".. is the same as eprint "..."
"Hello, World!"
}
And to compile use zc.
zc hello.zc && ./hello # or use ./zc if you haven't installed it.
You can also run it directly like this:
zc run hello.zc
Attribution: This is a community solution for the Rosetta Code task Hello world/Newbie in Zen C.
This article uses material from the Rosetta Code article Hello world/Newbie, which is released under the GNU Free Documentation License 1.3. A list of the original authors can be found in the page history.