Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6069851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:52:03+00:00 2026-05-23T09:52:03+00:00

Boost Spirit Qi parser grammars are wonderful, and I use them for small things

  • 0

Boost Spirit Qi parser grammars are wonderful, and I use them for small things all the time. However, there are times when I would like to be able to compose separate grammars.

This is easy to do all-in-one in a single compile by #including the appropriate grammars and stitching them together. However, this makes compile times start going through the roof. There are other drawbacks as well.

Is there any way to compose separately compiled grammars? In other words, I’d like to define a grammar’s interface in a header file, implement the template and it’s instantiation for a particular Iterator in a separate compilation unit, and then be able to use the grammar from another, without having the full template definition visible at compile time. In other words, I want to be able to use a grammar in a rule indirectly.

Is such a thing possible? If it is, how would one go about it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:52:04+00:00Added an answer on May 23, 2026 at 9:52 am

    I don’t think this is something specific to Spirit, but rather C++ 101. If you need to compose several grammars you need to include the corresponding header files defining the grammars you want to use while composing. What you might want to do is to separate the compilation of the grammar constructor into a separate compilation unit. See the Spirit calculator examples (mini_c and others) to see how this can be done. This will keep your compilation times at bay.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a Boost Spirit 2.0 based parser for a small subset of
Synopsis I would like to harness Boost Spirit's stream parser API to parse an
I am using Boost Spirit parser, and as the parser is parsing, semantic actions
I'm doing an IRC message parser with Boost.Spirit but I'm getting a (very long)
How does one use boost::spirit with an input that consists of something other than
I've been looking recently at Boost.Spirit (the version included in Boost 1.39), however I'm
I'm wondering if there's a way in boost::spirit::lex to write a token value back
I am trying to use Boost.Spirit (V. 2.5) library to create a mini-calculator. Features
I am trying to write a python parser with boost::spirit library. Here is the
I am trying to use the Spirit library for the first time. I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.