Vendor things
This commit is contained in:
parent
5deceec006
commit
977e3c17e5
19434 changed files with 10682014 additions and 0 deletions
20
third-party/vendor/winnow/examples/s_expression/main.rs
vendored
Normal file
20
third-party/vendor/winnow/examples/s_expression/main.rs
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
//! In this example we build an [S-expression](https://en.wikipedia.org/wiki/S-expression)
|
||||
//! parser and tiny [lisp](https://en.wikipedia.org/wiki/Lisp_(programming_language)) interpreter.
|
||||
//! Lisp is a simple type of language made up of Atoms and Lists, forming easily parsable trees.
|
||||
|
||||
#![cfg(feature = "alloc")]
|
||||
|
||||
mod parser;
|
||||
|
||||
fn main() {
|
||||
let expression_1 = "((if (= (+ 3 (/ 9 3))
|
||||
(* 2 3))
|
||||
*
|
||||
/)
|
||||
456 123)";
|
||||
println!(
|
||||
"\"{}\"\nevaled gives us: {:?}",
|
||||
expression_1,
|
||||
parser::eval_from_str(expression_1)
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue