I am working on writing a simple parser in typed Racket, and as part of it, I want to parse string representations of s-expressions to lists as follows:
"(+ 1 (/ 2 (inc 0)))" => (list '+ 1 (list '/ 2 (list 'inc 0 ))). Is there an easy way to do this?
i'm not sure how you exactly expect the conversion result works, but i have to proposals for you.
Supposing this is the current behaviour of your list:
The first one
This will work exactly as your current list (executing in console):
The second one
This will convert the input string exactly as your desired output, an then convert it into list (executing in console):
I hope this was helpful for you! Let me know if something gone wrong!