Step 1: Create an AST

This step consists of creating the AST to represent the input
expression, the only evaluation done for now is the recognition of three
MalTypes for the nodes of the AST:
- Symbols: atomic isolated groups of characters
- Integers: Symbols that can be parsed as number and are treated as so
- Lists: recognizable by the presence of parentheses (only "()" for now,
  "[]" and "{}" later), these can contain any number of MalTypes

The second half of this step (much easier) is to reconstruct the
original syntax (with clean whitespaces) to check the correctness of the
process

Signed-off-by: teo3300 <matteo.rogora@live.it>
This commit is contained in:
teo3300
2023-06-05 23:04:51 +02:00
parent 9144fc04bc
commit 13790d0864
5 changed files with 194 additions and 3 deletions

View File

@ -1,8 +1,12 @@
// io lib to read input and print output
use std::io::{self, Write};
mod step0_repl;
use step0_repl::rep;
mod printer;
mod reader;
mod types;
mod step1_read_print;
use step1_read_print::rep;
fn main() -> io::Result<()> {
loop {
@ -14,6 +18,6 @@ fn main() -> io::Result<()> {
io::stdin().read_line(&mut input)?;
print!("{}", rep(&input));
println!("{}", rep(&input.replace("\n", " ")));
}
}