Can we design a language (cpp-prime?) that is basically c++ but makes parsing easier? I'm thinking reduce the keyword reuse, use different symbols for multiplication and pointers etc. The code would be easy for c++ developers to read and converting between the two could be automatic. However, we would be able to build tooling for this new language much more easily. It would also compile quicker.
Parsing C++ is literally undecidable (2013)
11–20 of 146 posts
Re: Parsing C++ is literally undecidable (2013)
#12Why shouldn't C++ templates be Turing-complete? Template metaprogramming is a great strength of C++. The language is gross but the result is quite powerful.
Re: Parsing C++ is literally undecidable (2013)
#13Can we design a language (cpp-prime?) that is basically c++ but makes parsing easier? I'm thinking reduce the keyword reuse, use different symbols for multiplication and pointers etc. The code would be easy for c++ developers to read and converting between the two could be automatic. However, we would be able to build tooling for this new language much more easily. It would also compile quicker.
Re: Parsing C++ is literally undecidable (2013)
#14This is why the tools situation in c++ had been so far behind other languages like Java. You have to build a full frontend to even parse the language. They're slowly becoming available via clang now, which is nice.
Java has generics and overloading; how far can you realistically get before building a full frontend? Honest question.
Re: Parsing C++ is literally undecidable (2013)
#15Doesn't this require "typename" at the beginning of the line?
Re: Parsing C++ is literally undecidable (2013)
#16This is why the tools situation in c++ had been so far behind other languages like Java. You have to build a full frontend to even parse the language. They're slowly becoming available via clang now, which is nice.
I wonder if it's possible to craft a non-gigantic C++ file which causes a clang frontend to crash.
You could pick the winning entries and use them as a corpus for a fuzzer and you might find compiler crashes.
Re: Parsing C++ is literally undecidable (2013)
#17> If it is not SomeType, then ::name is a typedef for int and the parse tree is declaring a pointer-to-int named x. Doesn't this require "typename" at the beginning of the line?
Re: Parsing C++ is literally undecidable (2013)
#18Can we design a language (cpp-prime?) that is basically c++ but makes parsing easier? I'm thinking reduce the keyword reuse, use different symbols for multiplication and pointers etc. The code would be easy for c++ developers to read and converting between the two could be automatic. However, we would be able to build tooling for this new language much more easily. It would also compile quicker.
Re: Parsing C++ is literally undecidable (2013)
#19Can we design a language (cpp-prime?) that is basically c++ but makes parsing easier? I'm thinking reduce the keyword reuse, use different symbols for multiplication and pointers etc. The code would be easy for c++ developers to read and converting between the two could be automatic. However, we would be able to build tooling for this new language much more easily. It would also compile quicker.
In theory that's D. D was designed to be easier to parse than C++, for example, it uses Foo!Bar and Foo!(Bar, 4) template syntax rather than Foo and Foo . On the other hand, it still uses templates and supports mixins (basically #define on steroids), so while it's easy to parse, large chunks of code don't exist until compile time so can't be indexed by IDEs perfectly.
Even if C++ is a little baroque, C++17 and now C++20 provide many of the D's benefits, while keeping all the libraries, and finally we are getting Java like C++'s tooling to just throw it away.
Re: Parsing C++ is literally undecidable (2013)
#20Earlier quoted context omitted.
In theory that's D. D was designed to be easier to parse than C++, for example, it uses Foo!Bar and Foo!(Bar, 4) template syntax rather than Foo and Foo . On the other hand, it still uses templates and supports mixins (basically #define on steroids), so while it's easy to parse, large chunks of code don't exist until compile time so can't be indexed by IDEs perfectly.
And as much as I like their community, I feel it already lost its spotlight opportunity, due to their lack of manpower vs other languages offerings and continuous improvements. Even if C++ is a little baroque, C++17 and now C++20 provide many of the D's benefits, while keeping all the libraries, and finally we are getting Java like C++'s tooling to just throw it away.
No. D failed due to a mandatory GC and the 'two standard libraries' idiocy.