News for hackers. Stuff that matters.
Re:Corrode: C to Rust translator written in Haskell by tinco on Friday July 08, 2016 @12:58PM (#12056946)
Absolutely blown away by the detail of the documentation. The main logic of this project is in a literate haskell file you can easily read on GitHub.

https://github.com/jameysharp/corrode/blob/master/src/Langua...

I wonder how readable is to someone who isn't experienced in Haskell. To me reads like a breeze, but I have a project using the exact same parsing library so maybe that puts me at an advantage.

The language-c library he uses is an excellent one, it's a fully spec compliant C parser that's well maintained. I've based my C compiler on it and I haven't encountered any C code it couldn't parse yet. One time I upgraded to a new OSX and Apple added some stupid thing to their headers that broke the parser and a fix was merged within days. This means it takes away the entire headache of parsing C leaving just the actual compiling.

Re:Corrode: C to Rust translator written in Haskell by mgattozzi on Friday July 08, 2016 @02:08PM (#12057522)
It's not that bad to read. The documentation alone makes it easy to work on. This was dropped in the /r/rust thread: http://jamey.thesharps.us/2016/07/translating-c-to-rust-and-...

He lays it out fairly well for people to help out.

Re:Corrode: C to Rust translator written in Haskell by fractalsea on Saturday July 09, 2016 @04:23AM (#12060662)
The documentation is amazing. One problem I find with rendered literate haskell is that it because quickly unclear how the indentation across blocks of code fits together. It would be nice if there was some kind of renderer that kept the indentation in the docs, or had some kind of "indentation guide".
Re:Corrode: C to Rust translator written in Haskell by eridius on Friday July 08, 2016 @01:16PM (#12057105)
By "some stupid thing to their headers" are you referring to nullability annotations? I'm not sure what else Apple would have added to pure C headers (as opposed to obj-c) any time in the past few years.
Re:Corrode: C to Rust translator written in Haskell by tinco on Friday July 08, 2016 @03:16PM (#12057961)
I wanted my compiler to be able to compile a hello world. Something which would be trivial in any language, though of course not C. In C the first line of hello world is "#include<stdio.h>". No doubt known to you, that file is a veritable quagmire of incomprehensible C constructions, specific to each operating system. So I spent a few too many nights getting my compiler to get any possible C declaration known to mankind into its symboltables, just so I could get it to the code generator phase and emit all of three or so instructions.

I forgot what the change was, and I can't find the commit that fixed it, as it seems active development on the library has resumed.

Re:Corrode: C to Rust translator written in Haskell by axman6 on Friday July 08, 2016 @10:34PM (#12059806)
It was possibly even a Apple added their blocks extension to C and Obj-C, I remember this verifying some issues for Haskell tool which parsed C.
Re:Corrode: C to Rust translator written in Haskell by eridius on Saturday July 09, 2016 @05:21PM (#12063385)
That was many years ago. I was assuming tinco was referring to something more recent. Besides, AFAIK, every usage of blocks in Apple's headers is guarded by an #if check to make sure blocks are supported, so compilers that don't support blocks won't even see them.
Re:Corrode: C to Rust translator written in Haskell by duaneb on Friday July 08, 2016 @11:31PM (#12059956)
Blocks, maybe? Not standardized but it's cross platform and compiler.
Re:Corrode: C to Rust translator written in Haskell by solidsnack9000 on Friday July 08, 2016 @01:58PM (#12057437)
I would like to know, too.