brundonsmith / rust_lisp

A Rust-embeddable Lisp, with support for interop with native Rust functions
234 stars 20 forks source link

REPL Ctrl-D termination, unclosed string handling and other refactors #9

Closed alexmozaidze closed 2 years ago

alexmozaidze commented 2 years ago

After I've read your blog, I decided to check on parser.rs and found out how simple it actually is, which amazed me. I like the blogs, keep it up.

I did following things in this PR:

brundonsmith commented 2 years ago

Some thoughts:

Otherwise I think these changes look good

brundonsmith commented 2 years ago

Ah, one other thing- there are some |c: char|s in here that don't need the type annotation

alexmozaidze commented 2 years ago

Yeah, .lines() returns an iterator, and it's None when Ctrl-D is hit. I was quite surprised it worked so well.

alexmozaidze commented 2 years ago

I did the changes and simplified read_atom() by ommiting unclosed strings check; it is not needed because we drop unclosed string on tokenization step now.

brundonsmith commented 2 years ago

Merged and published to crates.io