Crates.io | ream |
lib.rs | ream |
version | 0.4.2 |
source | src |
created_at | 2021-04-27 06:13:01.152622 |
updated_at | 2021-05-27 02:26:51.107897 |
description | Data language for building maintainable social science datasets |
homepage | https://ream-lang.org |
repository | https://github.com/chmlee/ream-core |
max_upload_size | |
id | 390031 |
size | 107,921 |
REAM is a data language for building maintainable social science datasets. It encourages inline documentation for individual data points, and introduces features to reduce repetition.
The language has three main components:
REAM compiles to both human-readable documentation (HTML, PDF, etc.) and analysis-ready datasets (CSV, JSON, etc.) Two formats, one source.
# Country
- name: Belgium
- capital: Brussels
- population: 11433256
> data from 2019; retrieved from World Bank
- euro_zone: TRUE
> joined in 1999
## Language
- name: Dutch
- size: 0.59
## Language
- name: French
- size: 0.4
## Language
- name: German
- size: 0.01
compiles to
Belgium,Brussels,11433256,TRUE,Dutch,0.59
Belgium,Brussels,11433256,TRUE,French,0.4
Belgium,Brussels,11433256,TRUE,German,0.01
The official REAM documentation provides more information on the language. The rest of the README focuses on the compiler, ream-core.
Two web-based editors with ream-core embedded are available without local installation:
For a local copy of the commandline tool, you will need Cargo and install in one of the two ways:
cargo install ream
git clone https://github.com/chmlee/ream-core
cd ream-core && cargo build
Now you have commandline tool ream
available locally.
To compile your REAM file, execute:
ream -i <INPUT> -o <OUTPUT> -f <FORMAT> [-p]
where <INPUT>
is the path to the REAM file and <OUTPUT>
the path of the output file.
For <FORMAT>
there are two options: CSV
and AST
(abstract syntax tree).
If the -p
flag is present, the output will also be printed out as stdout.
Example:
ream -i my_data.ream -o my_data.csv -f CSV -p
To include ream-core into your Rust project, add the following line to your Cargo.toml
file:
[dependencies]
ream = "0.3.1"
See docs.rs for more information.
wasm-pack
is requried to compile ream-core to WebAssembly.
git clone https://github.com/chmlee/ream-core
cd ream-core && wasm-pack build --target web
Two functions are avaiable in the WASM module: ream2csv
and ream2ast
:
import init, {ream2csv, ream2ast} from "./ream.js";
init()
.then(() => {
let csv = ream2csv(input);
let ast = ream2ast(input);
})