What is CPP? Holy shit... (0.38.4)
This commit is contained in:
parent
d39ef1a58e
commit
d79815e366
10 changed files with 158 additions and 4 deletions
28
examples/cpp_add.fun
Executable file
28
examples/cpp_add.fun
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env fun
|
||||
|
||||
/*
|
||||
* This file is part of the Fun programming language.
|
||||
* https://fun-lang.xyz/
|
||||
*
|
||||
* Copyright 2026 Johannes Findeisen <you@hanez.org>
|
||||
* Licensed under the terms of the Apache-2.0 license.
|
||||
* https://opensource.org/license/apache-2-0
|
||||
*
|
||||
* Added: 2026-01-29
|
||||
*/
|
||||
|
||||
/*
|
||||
Build:
|
||||
cmake -S . -B build_debug -DFUN_WITH_CPP=ON
|
||||
cmake --build build_debug --target fun
|
||||
Run:
|
||||
build_debug/fun examples/cpp_add.fun
|
||||
*/
|
||||
|
||||
number x = cpp_add(2, 40)
|
||||
//print("typeof(x): " + typeof(x))
|
||||
print(x)
|
||||
|
||||
/* Expected output:
|
||||
42
|
||||
*/
|
||||
0
examples/rust_hello_args_return.fun
Normal file → Executable file
0
examples/rust_hello_args_return.fun
Normal file → Executable file
2
examples/rust_vm_access.fun
Normal file → Executable file
2
examples/rust_vm_access.fun
Normal file → Executable file
|
|
@ -23,7 +23,7 @@ print("[Rust VM access demo]")
|
|||
print("vm.sp (from Rust) = " + to_string(rust_get_sp()))
|
||||
|
||||
/* Write vm.exit_code via Rust (not directly observable without VM inspection) */
|
||||
print("Setting vm.exit_code to 5 via Rust...")
|
||||
print("Setting vm.exit_code to 42 via Rust...")
|
||||
rust_set_exit(42)
|
||||
|
||||
print("Now exiting...")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue