| Crates.io | laconic |
| lib.rs | laconic |
| version | 1.0.1 |
| created_at | 2025-09-16 18:41:52.248882+00 |
| updated_at | 2025-09-17 17:51:09.737213+00 |
| description | Interpreter for Laconic expressions and scripts, both as a library component and command-line executable |
| homepage | https://github.com/KoenLBekx/laconic |
| repository | https://github.com/KoenLBekx/laconic |
| max_upload_size | |
| id | 1842190 |
| size | 458,204 |
I got carried away, because I had fun.
I needed an embeddable concise expression interpreter, but Laconic nearly became a programming language:
besides numeric, boolean, string and date operators, it provides variables, tests, loops, routines, standard input & output, file I/O and error handling.
- Koen Bekx
Laconic is a Polish notation expression interpreter :
*+4 2 3
evaluates to 18.
The Laconic crate provides both
...$ laconic '*+4 2 3'
Execute the
laconicexecutable without any parameters to get help.
struct Interpreter, which can be used by other applications: use laconic::Interpreter;
let mut interpreter = Interpreter::new_stdio_filesys();
let exe_result = interpreter.execute("*+4 2 3".to_string());
assert!(exe_result.is_ok());
assert_eq!(18_f64, exe_result.unwrap().numeric_value());
The many operators understood by the Laconic interpreter, together with the way it expects numbers and strings to be represented, constitute the Laconic language - see the crate's documentation.
Note that a
struct Interpreterinstance can interprete or execute several scripts or expressions after one another, and preserves Laconic variables and routines that were assigned or declared in previous executions.
This would allow some Laconic snippets in a specific file type to assign values to variables which can be used by subsequent snippets.
Practical example:
a PostScript image file that would contain Laconic expression snippets in double quotes.
An application could preprocess this file by replacing the snippets with the actual numerical value returned by their interpretation by the same Laconic
Interpreterinstance and, next, removing the single-snippet lines that aren't valid PostScript commands.