finn-assembler-0.1.0 is not a library.
Finn-Assembler
The assembler for the Finn IR implemented using my HLVM in Rust
Finn IR
Finn IR is a minimal language that is meant to be targetted by other languages.
It compiles to Rust, which is then compiled to a binary.
Finn IR can import Rust functions extremely easily, but I haven't added an include function / opcode yet, so you can't just include your crate. However, you can edit the source and test it for yourself.
Foreign Function Interface
This is an example of the compiled Rust source that implements a foreign function.
use *;
use *;
// These functions are found in the included `include_test` crate
//
// use std::io;
// use std::io::Write;
// pub fn get_input(prompt: &str) -> String {
// print!("{}",prompt);
// io::stdout().flush().unwrap();
// let mut input = String::new();
// match io::stdin().read_line(&mut input) {
// Ok(_goes_into_input_above) => {},
// Err(_no_updates_is_fine) => {},
// }
// input.trim().to_string()
// }
//
//
// pub fn input(v: Value) -> Value {
// string(&get_input(&v.as_string()))
// }
All you would have to do to use that foreign function is put the @
symbol after an identifier to specify it as a foreign function.
">> " input@! user_input=
"You said: " print! user_input println!
input@
refers to our foreign function, and !
calls it with the argument ">> "
.
Examples
Fibonacci
=
1000 fib!
fib
Factorial
=
10000 factorial! println!
factorial
Lambda Calculus
=
False=
And=
True True And!!!!!
True