Missed the chance to name it "Crust."
There are already several projects called crust, including https://crates.io/crates/crust
Corrode: C to Rust translator written in Haskell
31–40 of 127 posts
Re: Corrode: C to Rust translator written in Haskell
#32https://github.com/jameysharp/corrode/blob/master/src/Langua...
Re: Corrode: C to Rust translator written in Haskell
#33Earlier quoted context omitted.
I was going to downvote you for a snarky response (I felt the reply explaining that Rust also has iron/oxidation references was a better response)... ... but that's a really good link that you provided. I've never read that before & it's a great resource for thinking about how to behave socially as a programmer. While I don't agree with all of it, I love their "don't pile-on" and "don't bring negativity from outside"…
Why are they talking specifically about _feigning_ surprise? Isn't the effect the same even if you're honestly surprised?
Re: Corrode: C to Rust translator written in Haskell
#34It's too bad this is written in Haskell. I don't have anything against Haskell, it is just not as popular a language as others.[1] Any ANTLR target language would have been a solid choice.[2] This way more of the community could contribute. This is an invaluable tool if we're truly going to see a shift from C (or C++) to Rust. [1] http://pypl.github.io/PYPL.html [2] http://www.antlr.org/download.html
Granted most of my use cases was building a simple DSL so it might be different when talking about whole source conversion.
Re: Corrode: C to Rust translator written in Haskell
#35as many "transpilers" / compilers, whatever you might name them, it lacks example input output. I want to see how my new rust code base looks light, does it compile with some heuritics, or just 1:1 C to rust primitives?
Here you go. It didn't like my stdio.h. Apparently enums and unions aren't supported, but: extern int printf(char *, ...); int main(int argc, char argv[]) { printf("Hello, world!\n"); return 0; } Was turned into: extern { fn printf(arg1 : *mut u8, ...) -> i32; } #[no_mangle] pub unsafe fn main(mut argc : i32, mut argv : *mut u8) -> i32 { printf(b"Hello, world!\n\0".as_ptr() as (*mut u8)); 0i32 } edit: Also worth noti…
Re: Corrode: C to Rust translator written in Haskell
#36Earlier quoted context omitted.
I was going to downvote you for a snarky response (I felt the reply explaining that Rust also has iron/oxidation references was a better response)... ... but that's a really good link that you provided. I've never read that before & it's a great resource for thinking about how to behave socially as a programmer. While I don't agree with all of it, I love their "don't pile-on" and "don't bring negativity from outside"…
Why are they talking specifically about _feigning_ surprise? Isn't the effect the same even if you're honestly surprised?
For me at least, it was a better explanation than XKCD 1053: https://xkcd.com/1053/
Re: Corrode: C to Rust translator written in Haskell
#37https://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
#38It's too bad this is written in Haskell. I don't have anything against Haskell, it is just not as popular a language as others.[1] Any ANTLR target language would have been a solid choice.[2] This way more of the community could contribute. This is an invaluable tool if we're truly going to see a shift from C (or C++) to Rust. [1] http://pypl.github.io/PYPL.html [2] http://www.antlr.org/download.html
Re: Corrode: C to Rust translator written in Haskell
#39It's too bad this is written in Haskell. I don't have anything against Haskell, it is just not as popular a language as others.[1] Any ANTLR target language would have been a solid choice.[2] This way more of the community could contribute. This is an invaluable tool if we're truly going to see a shift from C (or C++) to Rust. [1] http://pypl.github.io/PYPL.html [2] http://www.antlr.org/download.html
I've used ANTLR in anger a few times and for some reason it's always left a bad taste in my mouth. I always seem to spend more time debugging how ANTLR works rather than doing the work I set out to do. Granted most of my use cases was building a simple DSL so it might be different when talking about whole source conversion.
Re: Corrode: C to Rust translator written in Haskell
#40I was curious about how this worked so I looked into the source a little (even though Haskell isn't exactly my cup of tea), and WOW... This is just amazing. The most important part of the source is highly educative literate haskell: https://github.com/jameysharp/corrode/blob/master/src/Langua...
Kinda taking Rust's doc unit tests format to a whole new level.