3 ms·
I'd argue the idea of an "interpreter" is one of the most foundational concepts of CS. It sounds really basic, but the idea of being handed a description, and
by mattgreenrocks 5y ago
I'd argue the idea of an "interpreter" is one of the most foundational concepts of CS.
It sounds really basic, but the idea of being handed a description, and doing/creating something based on that is everywhere. It is really quite beautiful.
- Zababa 5y agoIt comes up often too. A few month ago I wanted to make a part of the code I was working on more declarative, so I had it take a javascript object that described a layout, and make actions depending on that object. That's a form of interpreter in a way.
- chubot 5y agoIIRC it's even in the "Design Patterns" book -- the Interpreter pattern. It really does come up a lot.
- agumonkey 5y agoTo me it was the recursive mapping over a closed set of types, whatever you do you should end up with an element of your type/grammar. That and the graph walk space of the AST.
- afdsfgdfhg 5y agoI'm currently writing a compiler so I'm not new to this, but I've no idea what you just said. Have you any links to explain it? TIA
- mattgreenrocks 5y agoThe closed set of types describes how each pass in a compiler pipeline tends to build an intermediate representation of some sort, analyze/modify it, and then output it to the next stage. The IR is closed in that it is not open for everyone to extend willy-nilly. It is this property that makes it even possible to analyze and manipulate in a sound manner. In a sense, compilers literally build a bunch of linguistic 'worlds' within their pipeline, each one emphasizing something different.