3 ms·
The type of REPL he's referring to has very specific features. Read returns a parsed structure, eval evaluates a parsed structure and print writes a parsed stru
by turkeysandwich 15y ago
The type of REPL he's referring to has very specific features. Read returns a parsed structure, eval evaluates a parsed structure and print writes a parsed structure. Python's REPL just deals with strings, I believe.
- praptak 15y agoYes, this is the case - Python's REPL (and eval) deals with strings and does not go through an explicit representation of the parsed code, mainly because there is no such representation in Python. There is an ast module that parses Python code but it is an add-on, not at the core of the implementation. That is what I meant by manifestation of deeper differences between Python and Lisp.
- aangjie 15y agoThis makes me think. I know the ast module is an add-on and not at the core of the interpreter implementation. Has there been any attempts at building a interpreter that does the same(Read, eval,print, loop over data structures and not strings)?? It would be hard i guess, but interesting right?
- xyzzyz 15y agoAll interpreters do it on some level, they just don't expose this functionality to user. As soon as you want to expose it to user in a non cumbersome way, you realize that the thing that stands in your way is the syntax of your language -- converting from textual and structural representation back and forth does not look like the way to go. You need to get rid of one of them for it to make sense. But if you get rid of textual representation, you'll just get another Lisp.