https://github.com/colltoaction/serde-yaml-risp
A YAML-based syntax crate for risp the rusty Lisp
https://github.com/colltoaction/serde-yaml-risp
Last synced: over 1 year ago
JSON representation
A YAML-based syntax crate for risp the rusty Lisp
- Host: GitHub
- URL: https://github.com/colltoaction/serde-yaml-risp
- Owner: colltoaction
- License: cc0-1.0
- Created: 2021-05-15T21:19:22.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-05-15T21:49:04.000Z (about 5 years ago)
- Last Synced: 2025-03-11T15:50:23.620Z (over 1 year ago)
- Language: Rust
- Size: 8.79 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# serde-yaml-risp [](https://crates.io/crates/serde-yaml-risp)
A YAML-based syntax crate for [risp] the rusty Lisp.
## Usage in Rust
### Add dependency
```toml
[dependencies]
risp = "0.7"
serde = { version = "1.0", features = ["derive"] }
serde_yaml = "0.8"
serde-yaml-risp = "0.1"
```
### Using the library
```rust
extern crate risp;
use risp::core::create_core_environment;
use risp::eval::eval;
use serde_yaml::Value;
fn main() {
let input = "[ def, my_int, 2 ]";
let value = serde_yaml::from_str::(input).unwrap();
let file_risp = serde_yaml_risp::convert(&value);
let mut env = create_core_environment();
let r0 = eval(file_risp, &mut env);
println!("{:?}", r0);
}
```
## Running example
```sh
cargo run --example
```
## Conceptual model
```
[ YAML documents ]
| serde
↓
[ serde_yaml::Value ]
| serde-yaml-risp
↓
[ risp::types::RispType ]
| risp
↓
[ LISP programs ]
```
[risp]: https://crates.io/crates/risp