News for hackers. Stuff that matters.
Re:MLRISC – A framework for retargetable and optimizing comp... by fizixer on Sunday April 05, 2015 @07:33PM (#9325698)
Personally I'd like to be able to use a system that has human-readable C as a backend, along with the idea of 'semantic C' that I've discussed a couple times in the past. Anyone with me on this?

Past comment: https://news.ycombinator.com/item?id=8283025

Re:MLRISC – A framework for retargetable and optimizing comp... by platform on Monday April 06, 2015 @12:36AM (#9326550)
You might find an alignment of the vision with Nim http://nim-lang.org/ . The have done a C backend as for their language, and the language appears to have the semantic properties you have mentioned...

from the site:

" ... •Macros can use the imperative paradigm to construct parse trees. Nim does not require a different coding style for meta programming.

•Macros cannot change Nim's syntax because there is no need for it. Nim's syntax is flexible enough.

•Statements are grouped by indentation but can span multiple lines. Indentation must not contain tabulators so the compiler always sees the code the same way as you do "

Re:MLRISC – A framework for retargetable and optimizing comp... by the_why_of_y on Monday April 06, 2015 @07:49AM (#9327579)
C doesn't make for an optimal backend, due to issues like:

- no proper tail calls

- no way to cheaply check if arithmetic has overflowed, so performant arbitrary-precision integers are hard to implement

- hard to find GC roots on C stack

C-- is a better portable assembly language that was designed for such purposes.

http://www.cminusminus.org/

Unfortunately it looks like it hasn't found wider adoption (except for GHC), similar to MLRISC.

Re:MLRISC – A framework for retargetable and optimizing comp... by sitkack on Sunday April 05, 2015 @08:39PM (#9325864)
Base on that comment it sounds like you want C with AST based macros and a bidirectional canonical AST mapping. As the other poster pointed out, I'd start by porting sweetjs to C.