File: main.rs

package info (click to toggle)
rust-winnow 0.7.13-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,592 kB
  • sloc: makefile: 2
file content (20 lines) | stat: -rw-r--r-- 563 bytes parent folder | download | duplicates (57)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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)
    );
}