4 ms·
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
by fizixer 12y ago
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 https://news.ycombinator.com/item?id=8283025
- sitkack 12y agoBase 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.
- platform 12y agoYou might find an alignment of the vision with Nim http://nim-lang.org/ 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 "
- the_why_of_y 12y agoC 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/ http://www.cminusminus.org/ Unfortunately it looks like it hasn't found wider adoption (except for GHC), similar to MLRISC.