[HN Gopher] A Simple Interpreter in Python
       ___________________________________________________________________
        
       A Simple Interpreter in Python
        
       Author : dunefox
       Score  : 17 points
       Date   : 2021-08-21 10:29 UTC (12 hours ago)
        
 (HTM) web link (ruslanspivak.com)
 (TXT) w3m dump (ruslanspivak.com)
        
       | nicolasmelo1 wrote:
       | Man, this is was one of my favorite articles of all time. I've
       | created a functional programming language for my startup thanks
       | for this article. Obviously that there was many things that the
       | article didn't touch like how to mame tail call optmizations or
       | like how to suuport dictionaries or lists but anyway. This was
       | the quickstart for me for start making things.
       | 
       | I also recommend people reading this book: it is super complete
       | and comprehensive to get started and get your hands dirty
       | https://monkeylang.org/
       | 
       | Another thing i recommend which is what i ended up doing: instead
       | of interpreting stuff like
       | 
       | def visit_BinaryOperation(self, node): if node.operation ==
       | "add": return node.right + node.left
       | 
       | I just simply add the values inside of an object and then add
       | like
       | 
       | def visit_BinaryOperation(self, node): if node.operation ==
       | "add": return node.right._add_(node.left)
       | 
       | This way i can handle for example what happens if we add a string
       | with a string, or a int with a float INSIDE of the object of this
       | value. So if node.right is an object of type String we handle in
       | the _add_ method in the String class what happens if we add
       | together objects of different types like for example an Int with
       | a String.
       | 
       | But that's it. It is an awesome recommendation
        
       | ExtraE wrote:
       | (2015)
        
       ___________________________________________________________________
       (page generated 2021-08-21 23:01 UTC)