Git Product home page Git Product logo

splitting-large-x3-parsers's People

Contributors

sehe avatar

Watchers

 avatar James Cloos avatar

splitting-large-x3-parsers's Issues

Why not rm the SIOF by using template metaclass specialized on rule_id?

Seth,
I think the SIOF problem could be eliminated by using something like:

/** @file
 * Defines template class defn_gram,
 * for defining the type of right hand side(RHS) of a variable.
 * as the nested type.
 * The user should provide specializations for a particular
 * variable.  A macro to help doing this is in DEFN_GRAM.hpp.
 * No #include guards are provided because this could be
 * used in different grammars in same file.
 */
      template
      < symb_gram<symb_kinds::varble_kind>::syms AnVarble 
        /**@brief
         *  the variable whose RHS is being defined.
         */
      >
      struct
    defn_gram
     /**@brief
      *  Specializations contain nested type
      *  which is the type of the grammar expression
      *  defining AnVar.
      */
      ;

inserted in the parser namespace, and then, for each rule, provide a specialization of the above using
a macro, something like:

#ifndef GRAM_STK_DEFN_GRAM_SPECIAL_HPP_INCLUDED
#define GRAM_STK_DEFN_GRAM_SPECIAL_HPP_INCLUDED
/** @file
 */
/** @def DEFN_GRAM_SPECIAL
 *  @brief generates, within a grammar class, a specialization
 *    of defn_gram template class with nested 'using type'
 *  @param AnVarble the enumerator for the variable to be defined.
 *  @param Scope the scope (e.g. ClassName::) where the definition occurs.
 *     Note, it should be empty if the definition is inside the class.
 *  @param ... the definition of AnVarble
 */
#define DEFN_GRAM_SPECIAL(AnVarble,Scope, ...) \
      template<> \
      struct Scope \
    defn_gram \
      < Scope symb_gram<symb_kinds::varble_kind>::syms::AnVarble \
      > \
      { using type=decltype( __VA_ARGS__); \
      }; \
  //DEFN_GRAM define
#endif//GRAM_STK_DEFN_GRAM_SPECIAL_HPP_INCLUDED

Then, in the actual parser_rule, you could use the defn_gram::type to
retrieve the RHS of the rule with RuleId.

In the above, translated RuleId as AnVarble. The above is actually based on
code which uses enum's instead of local classes to be the equivalent of spirit's RuleId.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.