-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #175 from epage/example
docs(cookbook): Bring in more examples
- Loading branch information
Showing
15 changed files
with
401 additions
and
340 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
); | ||
} |
Oops, something went wrong.