boost::proto helpful for a compiler project?
How can boost proto help me in my compiler project? Is it another way to write a grammar and parse it? Peter Foelsche "The first point (using an init() function in preference to a constructor) is bogus. Using constructors and exception handling is a more general and systematic way of dealing with resource acquisition and initialization errors. This style is a relic of pre-exception C++." -- Stroustrup
Hi, well, as far as I understood proto, its for building Domain Specific Languages(DSL). For Parsing and Grammars there is already a project in boost, spirit, they build up on proto with spirit2 to implement a DSL for a parser/grammar framework. So as I don't know your needs, proto can help you a lot, maybe spirit has already done some work for you. regards, Jens Weller -------- Original-Nachricht --------
Datum: Mon, 26 Jan 2009 15:44:59 -0700 Von: peter_foelsche@agilent.com An: boost-users@lists.boost.org Betreff: [Boost-users] boost::proto helpful for a compiler project?
How can boost proto help me in my compiler project?
Is it another way to write a grammar and parse it?
Peter Foelsche
"The first point (using an init() function in preference to a constructor) is bogus. Using constructors and exception handling is a more general and systematic way of dealing with resource acquisition and initialization errors. This style is a relic of pre-exception C++." -- Stroustrup
-- NUR NOCH BIS 31.01.! GMX FreeDSL - Telefonanschluss + DSL für nur 16,37 EURO/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a
well, as far as I understood proto, its for building Domain Specific Languages(DSL). For Parsing and Grammars there is already a project in boost, spirit, they build up on proto with spirit2 to implement a DSL for a parser/grammar framework.
So as I don't know your needs, proto can help you a lot, maybe spirit has already done some work for you.
I'm reading proto_authors_corner_.pdf, which you could find it via searching the list archive, and immediately aware of that it would be of help to you, as far as your question is concerned.
regards,
Jens Weller
B/Rgds Max
peter_foelsche@agilent.com wrote:
How can boost proto help me in my compiler project?
Is it another way to write a grammar and parse it?
If by "compiler" you mean something that reads a text file, parses it according to a grammar and Does Something, then Proto is *not* what you are looking for. Use Boost.Spirit. -- Eric Niebler BoostPro Computing http://www.boostpro.com
ok. Can you give me an application area for boost::proto? In short I don't understand what DomainSpecificEmbeddedLanguage means. -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Eric Niebler Sent: Monday, January 26, 2009 16:08 To: boost-users@lists.boost.org Subject: Re: [Boost-users] boost::proto helpful for a compiler project? peter_foelsche@agilent.com wrote:
How can boost proto help me in my compiler project?
Is it another way to write a grammar and parse it?
If by "compiler" you mean something that reads a text file, parses it according to a grammar and Does Something, then Proto is *not* what you are looking for. Use Boost.Spirit. -- Eric Niebler BoostPro Computing http://www.boostpro.com _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Please don't top-post. See http://www.boost.org/community/policy.html#effective peter_foelsche@agilent.com wrote:
Eric Niebler wrote:
peter_foelsche@agilent.com wrote:
How can boost proto help me in my compiler project?
Is it another way to write a grammar and parse it?
If by "compiler" you mean something that reads a text file, parses it according to a grammar and Does Something, then Proto is *not* what you are looking for. Use Boost.Spirit.
ok. Can you give me an application area for boost::proto? In short I don't understand what DomainSpecificEmbeddedLanguage means.
The term is defined in Proto's documentation, and many examples are given there. http://boost-sandbox.sf.net/libs/proto HTH, -- Eric Niebler BoostPro Computing http://www.boostpro.com
I assume that by "top-posting" you mean that I did not prefix my subject with [proto] -- sorry. You are condescending. I'm just trying to understand this new library to see whether there are any areas of applications for me. I was already inside these examples. It sounded pretty much like a compiler-compiler to me. But I don't see any need to parse Object-Literals-expressions and execute them -- isn't there already a lambda library? Peter -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Eric Niebler Sent: Monday, January 26, 2009 16:42 To: boost-users@lists.boost.org Subject: Re: [Boost-users] boost::proto helpful for a compiler project? Please don't top-post. See http://www.boost.org/community/policy.html#effective peter_foelsche@agilent.com wrote:
Eric Niebler wrote:
peter_foelsche@agilent.com wrote:
How can boost proto help me in my compiler project?
Is it another way to write a grammar and parse it?
If by "compiler" you mean something that reads a text file, parses it according to a grammar and Does Something, then Proto is *not* what you are looking for. Use Boost.Spirit.
ok. Can you give me an application area for boost::proto? In short I don't understand what DomainSpecificEmbeddedLanguage means.
The term is defined in Proto's documentation, and many examples are given there. http://boost-sandbox.sf.net/libs/proto HTH, -- Eric Niebler BoostPro Computing http://www.boostpro.com _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
peter_foelsche@agilent.com wrote:
I assume that by "top-posting" you mean that I did not prefix my subject with [proto] -- sorry.
Peter - No, that is not what top posting means. As explained on the web page Eric references, top posting is placing your reply at the very top of the email, with the message you are replying to below that. In a detailed technical conversation (which many Boost conversations are) it makes it very difficult for anyone to keep track of details. Since details are important in Boost conversations, the posting policy actively discourages top posting.
You are condescending.
I'm sorry if you felt offended by any post on Boost (Eric's or any other), but please try to keep the conversation to professional tones and topics. You will find that typical Boost participants are very helpful people, but also very busy. It is reasonable to assume that any comment you consider brisk was not intended that way. It was just the result of trying to provide a rapid response. Even if you feel certain someone is behaving badly, maintaining a useful and constructive tone sets a better example and may help them become a more effective part of the conversation. The list has a collection of moderators who step in on the rare occasions anything has gotten out of hand. (I am not one of the moderators, by the way.)
I'm just trying to understand this new library to see whether there are any areas of applications for me.
I was already inside these examples.
It sounded pretty much like a compiler-compiler to me.
But I don't see any need to parse Object-Literals-expressions and execute them -- isn't there already a lambda library?
Peter
The topics of expression templates and DSELs are fairly large and involved. A detailed discussion is better found in books on templates, metaprogramming and related subjects (including the excellent one by Abrahms and Gurtovy) However, the goals are fairly simple. Expression templates use the template instantiation mechanism to produce code that customizes itself during instantiation to be a better fit to the needs of the problem at compile time. The typical example is a matrix math library that builds a near optimal algorithm based on the context of the equation where the matrix math is used. It provides the dual benefits of clear and expressive code with the potential for highly optimized performance. A DSEL is a Domain Specific Embedded Language. A language built to provide very good abstractions for a specific problem domain, that is a properly formed subset of some other, general purpose language. This lets the general purpose language naturally express abstractions and actions in the specific domain. When C++ is the general purpose language, designing a DSEL usually involves the template system, and expression templates. A good example for a DSEL is the Spirit library, which is also part of Boost. Spirit expresses parsing (and, with Spirit 2, also lexing and generation) in the language of EBNF grammars, but does so inside properly formed, and portable C++ code. While lambdas are also a useful tool for constructing DSELs, I think the makers of Spirit would argue that proto cannot be readily replaced by them. After all, Spirit uses proto and a lambda library called Phoenix as components. If this is enough where you now see the basic idea, I would suggest you look through proto, as well as Spirit and its other component pieces and see if you can understand how these tools are working together. They are very well designed libraries, and your understanding of the power of C++ will grow by leaps and bounds by studying them. (or, at least, mine did) I hope you find that a more satisfactory answer. John
participants (5)
-
Eric Niebler
-
Jens Weller
-
John Phillips
-
Max
-
peter_foelsche@agilent.com