The Letlang compiler translates the Letlang code to Rust code.
The structure is as follow:
- lib/src/std/
- io.let (see
11_std_io.let
)
- io.let (see
- examples/hello-world/
- letproject.toml
{ | |
"openapi": "3.0.3", | |
"info": { | |
"title": "NetBox REST API", | |
"version": "3.6.9 (3.6)", | |
"license": { | |
"name": "Apache v2 License" | |
} | |
}, | |
"paths": { |
#pragma once | |
#include <algorithm> | |
#include <array> | |
#include <random> | |
#include <glm/vec3.hpp> | |
#include <hex/coords.hpp> |
#pragma once | |
#include <type_traits> | |
#include <concepts> | |
#include <functional> | |
#include <stdexcept> | |
#include <optional> | |
#include <vector> | |
#include <tuple> |
let task_args: Vec<Value> = vec![]; | |
let mut block = func.call(&mut context, task_args); | |
let ignored = Value::Boolean(bool::default()); | |
let mut state = block.resume_with(ignored); | |
loop { | |
match &state { | |
GeneratorState::Yielded(FunctionInterruption::Effect { name, args }) => { | |
// try to handle side effect |
tokio::spawn(async move { | |
let process_handle = tokio::spawn(async move { | |
// run process's function | |
}); | |
let res = process_handle.await; | |
// notify the node of the process termination | |
}); |
The Letlang compiler translates the Letlang code to Rust code.
The structure is as follow:
11_std_io.let
)#[allow(unused_variables)] | |
#[allow(unused_imports)] | |
#[allow(dead_code)] | |
mod symbol_a { | |
use llcore_runtime::*; | |
pub fn const_a(context: Arc<Mutex<Context>>) -> Value { | |
Value::Primitive(PrimitiveValue::Number(42.0)) | |
} |
# Tooling configuration files | |
FROM scratch AS context | |
ADD package.json \ | |
yarn.lock \ | |
.eslintrc.js \ | |
.eslintignore \ | |
/workspace/ | |
# Source code |
When setting up a Python/Django project, I like to do a few things:
use genawaiter::{sync::gen, yield_, Generator}; | |
type MyGen = Box<dyn Generator<Yield = i32, Return = i32>>; | |
fn make_generator() -> MyGen { | |
let gen = gen!({ | |
yield_!(1); | |
yield_!(2); | |
yield_!(3); | |
4 |