6 ms·
JSCPP, a simple C++ interpreter written in JavaScript
- Areading314 8y agoA similar project, also good for educating but within a jupyter notebook for c++ https://github.com/QuantStack/xeus-cling https://github.com/QuantStack/xeus-cling
- mulle_nat 8y agoA simple C++ interpreter is an oxymoron.
- tntn 8y agoIt's c++ without the "object-oriented features," so that could be fairly simple.
- userbinator 8y agoThat's called C.
- amelius 8y agoIt could still support e.g. function templates (not sure if it actually does).
- hellofunk 8y agoC is C++ minus object-oriented features, increased type-safety, template meta-programming, lambdas, and many more features.
- gray_-_wolf 8y agoNot true, C has features missing from C++.
- k__ 8y agoWhich?
- FartyMcFarter 8y agohttps://www.quora.com/What-features-are-present-in-C-but-not-available-in-C++/answer/Sergey-Zubkov-1 https://www.quora.com/What-features-are-present-in-C-but-not...
- makapuf 8y agoThere is a more complete answer with a link but quickly : restrict, designated initializers, generic macros...
- madeuptempacct 8y agoSo, are there situations where one would use C over C++? I don't know C++, and only learned C while catching up on my fundamentals.
- hossbeast 8y agoRight, the useless cruft that makes your program impossible to read, let alone reason about
- hellofunk 8y agoHa! The lambdas and tools surrounding them in C++11 and later have vastly improved the ability to make programs much easier to read and reason about.
- jcelerier 8y agoyes, I guess all those C++ programs don't exist and C++ programmers don't actually read or write any programs.
- maccard 8y agoHardly. Compare std sort to qsort and tell me that it's superior.
- goatlover 8y agoIs this the cruft that gets reinvented in C whenever the project grows complex enough? Something like: any sufficiently complicated C program contains an ad-hoc, informally-specified, bug-ridden, slow implementation of half of C++'s features.
- tntn 8y agoI didn't write the README.
- dosshell 8y agoStrictly speaking, C++ is not anymore a superset of C. Mostly syntatic sugar but still, some C code can not be parsed by C++. But yeah, i know what you mean, i guess this is a bastard of C and C++?
- favorited 8y agoC++ was never a superset of C. The same keywords mean different things, character literals are different types, void pointer assignment works differently, etc.
- archgoon 8y agoNo, this isn't C either. The following doesn't work: struct Bob { int a; }; int main() { int a; struct Bob x; x.a = 3; return 0; } So when they say "without object oriented features" they seem to mean: "No extendable type system". Which does make this a lot simpler of a language.
- josefx 8y agoThe example uses the iostreams header instead of cstdio. Not sure how this would work without object-oriented features.
- Andoryuuta 8y agoIt seems like some of the C++ library features are special-cased. From the Q&A section of the readme: "Which notable features are not implemented yet? > Object-oriented features" "Which libraries are supported? > iostream (only cin and cout and endl)"
- andrewprock 8y agoThis appears to be a proof of concept, for the purposes of learning and exploration. From the README: "Currently, it is mainly for educational uses for a MOOC course I am running (and fun)." "Which features are implemented? (Most) operators"
- nutjob2 8y agoC++ is an oxymoron.
- blueline 8y agoalso relevant is cling, made by the folks at CERN https://github.com/root-project/cling https://github.com/root-project/cling https://root.cern.ch/cling https://root.cern.ch/cling
- mortdeus 8y agothis is neat. I noticed that with this we get Read–eval–print loop for C++. Which would make it really useful in an ide like light table.
- blt 8y agoCouldn't find in readme if templates are supported.
- FartyMcFarter 8y agoIt doesn't even support structs/classes. edit: Templated functions don't work either.
- wemdyjreichert 8y agoBut why? Most js engines (or at least V8) are written in c++.
- omegote 8y ago* A subset of C++.
- ashleyn 8y agoI was going to say, "Jesus Christ did one guy actually manage to write a fully standards-conformant C++ parser?"
- userbinator 8y agoI know of one guy who did, as well as inventing the D language, and he also visits HN and posts semi-regularly --- http://walterbright.com/ http://walterbright.com/