Oops, I Wrote a C++ Compiler
praeclarum.org
Oops, I Wrote a C++ Compiler
1–10 of 42 posts
Re: Oops, I Wrote a C++ Compiler
#2To address this problem, I use Zephyr ASDL to describe the abstract syntax of a language (which CPython also uses!)
It's a little DSL that lets you write an ML-style algebraic data type, and generates a bunch of code for you. In CPython, you go from ~100 lines ASDL schema to ~10,000 lines of C! It underlies the 'ast' module in the stdlib.
Why is Zephyr ASDL? http://www.oilshell.org/blog/2016/12/11.html
It eliminates the need for a lot of boilerplate he pointed out:
https://github.com/praeclarum/CLanguage/tree/master/CLanguag...
Re: Oops, I Wrote a C++ Compiler
#3People will be trying to port their existing code, and will be unpleasantly surprised.
> But the truth is, I’m just going to keep listening to users and improving the parts I can. I am not trying to recreate GCC or LLVM.
Why not use GCC or LLVM as part of your project? That seems like a better investment of your time.
Re: Oops, I Wrote a C++ Compiler
#4[1] restrictions may apply
Re: Oops, I Wrote a C++ Compiler
#5Please don't call it C++ if it doesn't even support constructors and destructors. People will be trying to port their existing code, and will be unpleasantly surprised. > But the truth is, I’m just going to keep listening to users and improving the parts I can. I am not trying to recreate GCC or LLVM. Why not use GCC or LLVM as part of your project? That seems like a better investment of your time.
At least they recognize this is missing, and call it out.
> Why not use GCC or LLVM as part of your project? That seems like a better investment of your time.
Learning opportunity? Maybe they're trying to solve a problem? Or do you think the LLVM folks should have just used GCC instead of wasting their time on LLVM?
Re: Oops, I Wrote a C++ Compiler
#6Please don't call it C++ if it doesn't even support constructors and destructors. People will be trying to port their existing code, and will be unpleasantly surprised. > But the truth is, I’m just going to keep listening to users and improving the parts I can. I am not trying to recreate GCC or LLVM. Why not use GCC or LLVM as part of your project? That seems like a better investment of your time.
Re: Oops, I Wrote a C++ Compiler
#7Re: Oops, I Wrote a C++ Compiler
#8Re: Oops, I Wrote a C++ Compiler
#9Please don't call it C++ if it doesn't even support constructors and destructors. People will be trying to port their existing code, and will be unpleasantly surprised. > But the truth is, I’m just going to keep listening to users and improving the parts I can. I am not trying to recreate GCC or LLVM. Why not use GCC or LLVM as part of your project? That seems like a better investment of your time.
That's not how the world gets compiler people.
Someone had to write GCC and LLVM, and someone will have to write whatever comes next. Languages and tooling only advance because there are those who choose to take the hard road instead of "just using that thing that someone else made".
Re: Oops, I Wrote a C++ Compiler
#10Please don't call it C++ if it doesn't even support constructors and destructors. People will be trying to port their existing code, and will be unpleasantly surprised. > But the truth is, I’m just going to keep listening to users and improving the parts I can. I am not trying to recreate GCC or LLVM. Why not use GCC or LLVM as part of your project? That seems like a better investment of your time.
It's more accurately a "C superset" compiler, or perhaps "C+".