C++ Libraries to parsing [closed] - c++

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm doing a software to generate animations for algorithms. These algorithms are written in an interpreted language, near to C (more or less a C-oriented pseudocode). Thus, my program must interprets algorithms written in these language. Also, this language will be incremented all the time to support more and more features. The key issue here is to search an library allowing increase the language easily and making easy integrate different parsers in the same program. The app is written in C++ licensed under GPL.
A object-oriented parser is my target solution indeed. I need help to choose a good library with this purposes. Also it's desirable the library is multiplataform and available in official repositories of commons distributions: Ubuntu, Suse and so on.
Actually, I know more or less well the next two libraries/tools:
Flex/Bison++: Both are Flex/Bison wrappers that allow generate C++ code instead of C code, and choose a name for your class. Problems: if you install Flex/Bison++, Flex/Bison are overwritten. I don't want to complicate users if they want compile my code. Moreover, CMake fails search the version number of the library. This can be solved manually, but isn't elegant.
Boost.Spirit: It doesn't have the previous problems and match with all desirable features I described above. But, I've read it isn't fine to parse big languages and to solve grammar ambiguities. Moreover, the compilation times are enormous. But, I love it can compose grammars in a constructive manner. This is very important to make the code/language/programm extensible.
What is your recommendation?

Related

what is a good functional language that can be mixed with C++? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I would like to walk the path of functional languages, since i have started i have only used OO languages and multi-paradigm languages; in the last period of time i have focused myself on C++ and in my understanding functional languages shines when you need to keep a consistent state and they are often used by some mission-critical services like banking services.
I don not want to leave C++, I would like to try a mix, I'm also interested only in cross-platform solutions among x86, ARM and Linux, Windows and BSD/Mac, so i suppose that F# is out ( also it appears to be just the Microsoft version of Ocaml for what i have read).
Can you suggest a language that will be good for this mix and clarify where and when a functional language can really offer the most ?
If you're interested in a language which is similar to C++ (with good C/C++ interoperability, too), but has powerful constructs from functional languages, you might like Rust. One of the Rust developers wrote up a comparison of Rust's and C++'s goals, which you might find informative.
Support for ARM does not yet exist, but Rust is LLVM-based, and LLVM supports ARM, so it's certainly possible to do.
Use C++11 lambda functions and expressions ;)

Why C++ can't be made as Python in terms of convenience [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
This question may seem to be naive.
But I think it'll be much worse if I don't ask it at all.
When a discussion begins about the features of Python that the developers love the most, they usually mention list comprehension, syntax relying on indentation (thus avoiding brackets, etc.) and some other.
At such moments I ask myself a question why there can't be made a language based on C++ but having a syntax like in Python and having all the features like list comprehensions, generators.
I understand that such a language won't have all the features that Python has, e.g. eval or exac statements (because they rely on Python being an interpreting language), may be some others that I don't know of.
But I also know that there is a project called Shedskin which makes a C code of a Python code (with some restrictions on what can be used in Python code).
So, are there some real reasons why it's impossible to create such a language that will combine all the best features of Python and a very fast code that produces C++? Or it's just the turn of events that Python for some reasons became very popular and it turned out to be interpreted, so a lot of people use it for its greatest features still discontent at the speed of the code, and some of them struggle to create something (like Shedskin or Psyco) to speed it up?
Google as created a language called Golang ( or Go). It is a compiled language with python like syntaxe. There are alot of video and documenttation that will answer your question there.

Useful features to learn in boost for immediate use [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I know this could be seen as subjective off-the-cuff (thus a poor question), but bear with me.
Boost has recently become available on the project on which I'm working, and I don't have much experience with it. Boost has so many parts and features that it's hard to know where to get started in learning it - especially since I'll be trying to learn it while making production code.
So, I would greatly appreciate it if someone could list around 3 to 5 features which are very useful in general, every-day programming and state why they're useful. I'm not asking you which is best, or trying to get a debate - I just want to know some good features to start learning and using immediately. I don't need code samples either, I'll be more than happy to research how to use the features myself after I know which ones are sensible to start learning now.
I'll accept any answer with a concise list of features that are sensible :)
format and lexical_cast are great for string manipulation, I find them invaluable. I use them every day.
bind is great for ad hoc functors, you'll find it is reused throughout many of the boost libraries.
multi_index fills the gap of when you need the same data in two search structures at once, it is very handy at times. Keep it out of your headers though.
type_traits defines useful traits for template specializations.
signals is a signal/slot mechanism implementation, great for event driven designs.
shared_pointer is critical. It lets you automatically handle memory usage.
http://www.boost.org/doc/libs/1_47_0/libs/smart_ptr/shared_ptr.htm

Dependency Injection framework for C++ [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Is there a DI framework comparable to Google Guice? And what does Google use?
There is nothing as mature or standard as Guice in the C++ world. However, some people have put together simplistic implementations on their own. Here's a couple.
http://adam.younglogic.com/2008/07/dependency-injection-in-c/ (source for implementation is at the end of the post)
http://sourceforge.net/projects/qtioccontainer/ (requires Qt)
http://code.google.com/p/autumnframework/ (hasn't been touched since 2007)
http://programmaticallyspeaking.blogspot.com/2010/04/beautiful-dependency-injection-in-c.html (more of a description, really)
http://sourceforge.net/projects/cpp-resolver/ ("Alpha" quality)
You're unlikely to be satisfied by any of these.
If you really wanted to put in the effort to rally the world around a DI framework for C++, probably the way to go about it would be to make a proposal to the Boost guys.
I'm the author of wallaroo. It's actively developed and has the following features:
it's lightweight but powerful
its interface supports both C++11 and C++98 with boost
it's type safe
it doesn't need custom preprocessors / code generators
you can load classes defined in shared libraries
you can use a DSL syntax for object creation and wiring or
you can get object creation and wiring by parsing one or more xml / json file.
Any comment, suggestion or request are welcome.
There is a recent one that looks very interesting called Hypodermic, i haven't tested it but it looks pretty active
I am currently authoring one called sauce, whose design (and name) is directly inspired by guice. I still consider it alpha, but you may find it useful.

python challenge, but for C++ [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
Does anyone know any site or book that presents problems like python challenge, but for C++?
When I think python challenge, I do not mean only a set of problems to be solved with C++ (for that I could probably use the same problems of python challenge), but rather problems that will probably be best solved using C++ STL, special features of the language, etc.
For example, there is one python challenge that is specifically designed to teach you how to use pickle, a serializing library for python.
Until now, I only know programming contests problems, but they could also be solved with C, java or other languages.
You might like to have a look at Herb Sutter's Guru of the Week series of articles.
Google Code Jam problems frequently have analyses with snippets of C++ code, probably because C++ is by far the most popular language used for solving code-jam problems. The latter also allows you to see many C++ constructs cleverly employed, as code-jam allows you to download the solutions by all the competitors. As most code is C++, you'll get to learn a lot of nice C++ tricks for efficient code.
There are many tasks on Rosetta Code that are not implemented in C++ as yet. Try your hand at those, especially if you can use advanced features (templates, external libraries, etc.) to produce a particularly nice solution. Remember that there is no fundamental reason why any of those tasks should be beyond the C++ language, and there's usually several other implementations in other languages to show you other ways to attempt the task, which can help a lot.
You're going to have a difficult time finding that because C++ provides less for you than almost any other language available. If C++ provides it, it's probably provided by Python or Java or C or any other programming language.
Why not try using some C++ concepts such as the STL to solve Project Euler problems?