News for hackers. Stuff that matters.
Re:Graal and Truffle could accelerate programming language d... by dragonwriter on Tuesday July 19, 2016 @02:36PM (#12123761)
> Because Lisp is homoiconic, you don't code in (what I personally believe to be) reasonable syntax, you code in abstract syntax trees.

There's no reason a regular macro couldn't implement a basically C-like syntax (though it would have Lisp, not C, tokenization rules, to the extent that those are different) on what is passed as its argument. The actual call to the macro would have typical Lisp syntax, but what the macro consumes would be interpreted with whatever syntax was implemented by the macro.

(And, a reader macro could implement more deeply C-like syntax.)

Re:Graal and Truffle could accelerate programming language d... by qwertyuiop924 on Tuesday July 19, 2016 @04:33PM (#12124678)
Well, for regular macros, only if your C syntax was in a string. Otherwise, lisp would try to tokenize it, and choke. Heck, if your lisp of choice offers an eqivalent of TCL's uplevel, you wouldn't even need a macro, just a function.
Re:Graal and Truffle could accelerate programming language d... by dragonwriter on Tuesday July 19, 2016 @04:39PM (#12124713)
> Well, for regular macros, only if your C syntax was in a string. Otherwise, lisp would try to tokenize it, and choke.

Which is why I said normal (rather than reader) macros could do a "basically C-like syntax" but with Lisp tokenization rules.

Re:Graal and Truffle could accelerate programming language d... by qwertyuiop924 on Tuesday July 19, 2016 @04:42PM (#12124740)
What would that look like?
Re:Graal and Truffle could accelerate programming language d... by TJSomething on Wednesday July 20, 2016 @01:37AM (#12127104)

  ((:include "stdio.h")
  
  (const char * message = "Like this.\n")
  
  (int main ((int argc) (char * * argv))
    (printf message)
    (return 0)))
Re:Graal and Truffle could accelerate programming language d... by qwertyuiop924 on Wednesday July 20, 2016 @06:21AM (#12127947)
Ah.
Re:Graal and Truffle could accelerate programming language d... by wcrichton on Tuesday July 19, 2016 @02:39PM (#12123785)
I've never seen something like this before--do you know of any examples of this kind of macro usage?
Re:Graal and Truffle could accelerate programming language d... by dragonwriter on Tuesday July 19, 2016 @02:45PM (#12123829)
This article provides a simpler (but conceptually similar, where it comes to implementing syntax different than standard Lisp S-expression syntax) example of using reader macros to implement JSON literals in Lisp.

https://gist.github.com/chaitanyagupta/9324402