/S-expression

simple subset S-expression evaluator

Primary LanguageRust

S-expression parser

Simplified S-expression parser written in rust for a coding interview

Example Usage

s-expression "(multiply (add 1 2) 3)"

Assumptions

  • all input is well formed
    • Parenthesis will always be balanced.
    • Only the add and multiply functions will be called.
    • There will always be a single space between the function arguments.
  • only natural numbers are used and not larger than an i64

Building

Min Rust version: 1.49.0 Requires the rustup tool chain and cargo

Libraries used

logos is a macro library for rust that can build fast and efficient lexers

rowan is the internal library used to build rust-analyzer is support abstract syntax tree parsing and evaluation

structopt is a macro library to build cli arguments using macros and structs