Created a very minimal lisp tokenizer in Rust

4 months ago by ghodawalaaman to c/rust

Hello,

I have been learning rust and want to make something exciting so I though why not build a Lisp compiler in Rust B)

so here what I did today. https://gist.github.com/...

the tokenizer isn't ready and might have horrible bugs but at least I got comfortable declaring immutable variable by default, not surrounding stuff with parentheses unnecessarily. oh and also Enums which is most powerful thing in rust as people say.

I am still not satisfied though since the code looks more like C than Rust xD

maybe some experienced people can correct me :)

ghodawalaaman 3 points 4 months ago

I just realized that it doesn't work with operators :(

just ignore that, I am aware of the error and will fix that. but the good new is that it works with nested lists :D

also I am checking if ch.is_alphabetic() which clearly won't work with operators like +,-,*,/ etc I wonder how can I fix it. I thought that if a token isn't Number or String it should be a Symbol but dummy me forgot that Symbol can contain special chars not just alphabets huh :(

path: 0 24123742, hotness: undefined, score: 3, children: 0
rust
rust

@lemmy.ml

login for more options
9402
397
129

go to feed...