2 ms·
I would never say never, but I haven't been able to think of a better way to represent programs than s-expressions despite many years of thinking about the prob
by pg 17y ago
I would never say never, but I haven't been able to think of a better way to represent programs than s-expressions despite many years of thinking about the problem.
I wouldn't be surprised if sexprs are the end in the sense that the integers are. I.e. you might go on to discover new things but they'd ultimately reduce to sexprs.
Is there a textual representation for ASTs? Could you write programs directly in ASTs?
- jules 17y agoTo your question: yes, the Perl syntax (the macro system supports quasiquotation). This is exactly the same as in Lisp. The difference is that Lisp syntax looks more like how the data structures are represented in memory. I think you can also build up your programs with data constructors (i.e. like doing (list 'lambda (list 'x) (list '+ 'x 1)) in Lisp). But note that I haven't used Perl6, this is information from the web.
- jey 17y ago"AST" is actually just compiler lingo for "tree representation of s-expr representation of parsed code". In other words: sure, you can write code directly in {ASTs, s-exprs}; it's called "Lisp". ;-)