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

  • SEARCH
  • Home
  • 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 6893459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:39:41+00:00 2026-05-27T06:39:41+00:00

i have defined a grammar with many rules, that uses many keywords. imagine it

  • 0

i have defined a grammar with many rules, that uses many keywords. imagine it like this (just with more of these rules and more keywords):

<keyword> ::= 'public' | 'protected' | 'private'

the gold-parser-system is generating a compiled grammar table (CGT) file, which is used by the several engines, in my case the calitha-engine for c#.

in order to realize some syntax-highlighting for my sourcecode which i want to parse, i want to get all the keywords of a range of rules. how do i extract them?

  • 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-27T06:39:42+00:00Added an answer on May 27, 2026 at 6:39 am

    Apart from generating “cgt” output file, Gold Builder has also XML output capability.

    If you feel comfortable with XML processing, I suggest you to extract the keywords using XML as one possible solution (See documentation).

    Here is a sample grammar XML file :

    <?GOLDParserTables version="1.0"?>
    <Tables>
            <Parameters>
                    <Parameter Name="Name" Value="(Untitled)"/>
                    <Parameter Name="Author" Value="(Unknown)"/>
                    <Parameter Name="Version" Value="(Not Specified)"/>
                    <Parameter Name="About" Value=""/>
                    <Parameter Name="Case Sensitive" Value="True"/>
                    <Parameter Name="Start Symbol" Value="8"/>
            </Parameters>
            <SymbolTable Count="12">
                    <Symbol Index="0" Name="EOF" Kind="3"/>
                    <Symbol Index="1" Name="Error" Kind="7"/>
                    <Symbol Index="2" Name="Whitespace" Kind="2"/>
                    <Symbol Index="3" Name="Comment End" Kind="5"/>
                    <Symbol Index="4" Name="Comment Line" Kind="6"/>
                    <Symbol Index="5" Name="Comment Start" Kind="4"/>
                    <Symbol Index="6" Name="Number" Kind="1"/>
                    <Symbol Index="7" Name="Word" Kind="1"/>
                    <Symbol Index="8" Name="Main" Kind="0"/>
                    <Symbol Index="9" Name="Number" Kind="0"/>
                    <Symbol Index="10" Name="Value" Kind="0"/>
                    <Symbol Index="11" Name="Word" Kind="0"/>
            </SymbolTable>
            <RuleTable Count="6">
                    <Rule Index="0" NonTerminalIndex="9" SymbolCount="1">
                            <RuleSymbol SymbolIndex="6"/>
                    </Rule>
                    <Rule Index="1" NonTerminalIndex="11" SymbolCount="1">
                            <RuleSymbol SymbolIndex="7"/>
                    </Rule>
                    <Rule Index="2" NonTerminalIndex="8" SymbolCount="2">
                            <RuleSymbol SymbolIndex="10"/>
                            <RuleSymbol SymbolIndex="8"/>
                    </Rule>
                    <Rule Index="3" NonTerminalIndex="8" SymbolCount="1">
                            <RuleSymbol SymbolIndex="10"/>
                    </Rule>
                    <Rule Index="4" NonTerminalIndex="10" SymbolCount="1">
                            <RuleSymbol SymbolIndex="11"/>
                    </Rule>
                    <Rule Index="5" NonTerminalIndex="10" SymbolCount="1">
                            <RuleSymbol SymbolIndex="9"/>
                    </Rule>
            </RuleTable>
            <CharSetTable Count="6">
                    <CharSet Index="0" Count="7">
                            <Char UnicodeIndex="9"/>
                            <Char UnicodeIndex="10"/>
                            <Char UnicodeIndex="11"/>
                            <Char UnicodeIndex="12"/>
                            <Char UnicodeIndex="13"/>
                            <Char UnicodeIndex="32"/>
                            <Char UnicodeIndex="160"/>
                    </CharSet>
                    <CharSet Index="1" Count="1">
                            <Char UnicodeIndex="42"/>
                    </CharSet>
                    <CharSet Index="2" Count="1">
                            <Char UnicodeIndex="59"/>
                    </CharSet>
                    <CharSet Index="3" Count="1">
                            <Char UnicodeIndex="47"/>
                    </CharSet>
                    <CharSet Index="4" Count="10">
                            <Char UnicodeIndex="48"/>
                            <Char UnicodeIndex="49"/>
                            <Char UnicodeIndex="50"/>
                            <Char UnicodeIndex="51"/>
                            <Char UnicodeIndex="52"/>
                            <Char UnicodeIndex="53"/>
                            <Char UnicodeIndex="54"/>
                            <Char UnicodeIndex="55"/>
                            <Char UnicodeIndex="56"/>
                            <Char UnicodeIndex="57"/>
                    </CharSet>
                    <CharSet Index="5" Count="52">
                            <Char UnicodeIndex="65"/>
                            <Char UnicodeIndex="66"/>
                            <Char UnicodeIndex="67"/>
                            <Char UnicodeIndex="68"/>
                            <Char UnicodeIndex="69"/>
                            <Char UnicodeIndex="70"/>
                            <Char UnicodeIndex="71"/>
                            <Char UnicodeIndex="72"/>
                            <Char UnicodeIndex="73"/>
                            <Char UnicodeIndex="74"/>
                            <Char UnicodeIndex="75"/>
                            <Char UnicodeIndex="76"/>
                            <Char UnicodeIndex="77"/>
                            <Char UnicodeIndex="78"/>
                            <Char UnicodeIndex="79"/>
                            <Char UnicodeIndex="80"/>
                            <Char UnicodeIndex="81"/>
                            <Char UnicodeIndex="82"/>
                            <Char UnicodeIndex="83"/>
                            <Char UnicodeIndex="84"/>
                            <Char UnicodeIndex="85"/>
                            <Char UnicodeIndex="86"/>
                            <Char UnicodeIndex="87"/>
                            <Char UnicodeIndex="88"/>
                            <Char UnicodeIndex="89"/>
                            <Char UnicodeIndex="90"/>
                            <Char UnicodeIndex="97"/>
                            <Char UnicodeIndex="98"/>
                            <Char UnicodeIndex="99"/>
                            <Char UnicodeIndex="100"/>
                            <Char UnicodeIndex="101"/>
                            <Char UnicodeIndex="102"/>
                            <Char UnicodeIndex="103"/>
                            <Char UnicodeIndex="104"/>
                            <Char UnicodeIndex="105"/>
                            <Char UnicodeIndex="106"/>
                            <Char UnicodeIndex="107"/>
                            <Char UnicodeIndex="108"/>
                            <Char UnicodeIndex="109"/>
                            <Char UnicodeIndex="110"/>
                            <Char UnicodeIndex="111"/>
                            <Char UnicodeIndex="112"/>
                            <Char UnicodeIndex="113"/>
                            <Char UnicodeIndex="114"/>
                            <Char UnicodeIndex="115"/>
                            <Char UnicodeIndex="116"/>
                            <Char UnicodeIndex="117"/>
                            <Char UnicodeIndex="118"/>
                            <Char UnicodeIndex="119"/>
                            <Char UnicodeIndex="120"/>
                            <Char UnicodeIndex="121"/>
                            <Char UnicodeIndex="122"/>
                    </CharSet>
            </CharSetTable>
            <DFATable Count="11" InitialState="0">
                    <DFAState Index="0" EdgeCount="6" AcceptSymbol="-1">
                            <DFAEdge CharSetIndex="0" Target="1"/>
                            <DFAEdge CharSetIndex="1" Target="2"/>
                            <DFAEdge CharSetIndex="2" Target="4"/>
                            <DFAEdge CharSetIndex="3" Target="5"/>
                            <DFAEdge CharSetIndex="4" Target="7"/>
                            <DFAEdge CharSetIndex="5" Target="8"/>
                    </DFAState>
                    <DFAState Index="1" EdgeCount="1" AcceptSymbol="2">
                            <DFAEdge CharSetIndex="0" Target="1"/>
                    </DFAState>
                    <DFAState Index="2" EdgeCount="1" AcceptSymbol="-1">
                            <DFAEdge CharSetIndex="3" Target="3"/>
                    </DFAState>
                    <DFAState Index="3" EdgeCount="0" AcceptSymbol="3">
                    </DFAState>
                    <DFAState Index="4" EdgeCount="0" AcceptSymbol="4">
                    </DFAState>
                    <DFAState Index="5" EdgeCount="1" AcceptSymbol="-1">
                            <DFAEdge CharSetIndex="1" Target="6"/>
                    </DFAState>
                    <DFAState Index="6" EdgeCount="0" AcceptSymbol="5">
                    </DFAState>
                    <DFAState Index="7" EdgeCount="1" AcceptSymbol="6">
                            <DFAEdge CharSetIndex="4" Target="7"/>
                    </DFAState>
                    <DFAState Index="8" EdgeCount="2" AcceptSymbol="-1">
                            <DFAEdge CharSetIndex="5" Target="9"/>
                            <DFAEdge CharSetIndex="4" Target="10"/>
                    </DFAState>
                    <DFAState Index="9" EdgeCount="2" AcceptSymbol="7">
                            <DFAEdge CharSetIndex="5" Target="9"/>
                            <DFAEdge CharSetIndex="4" Target="10"/>
                    </DFAState>
                    <DFAState Index="10" EdgeCount="2" AcceptSymbol="7">
                            <DFAEdge CharSetIndex="5" Target="9"/>
                            <DFAEdge CharSetIndex="4" Target="10"/>
                    </DFAState>
            </DFATable>
            <LALRTable Count="8"  InitialState="0">
                    <LALRState Index="0" ActionCount="6">
                            <LALRAction SymbolIndex="6" Action="1" Value="1"/>
                            <LALRAction SymbolIndex="7" Action="1" Value="2"/>
                            <LALRAction SymbolIndex="8" Action="3" Value="3"/>
                            <LALRAction SymbolIndex="9" Action="3" Value="4"/>
                            <LALRAction SymbolIndex="10" Action="3" Value="5"/>
                            <LALRAction SymbolIndex="11" Action="3" Value="6"/>
                    </LALRState>
                    <LALRState Index="1" ActionCount="3">
                            <LALRAction SymbolIndex="0" Action="2" Value="0"/>
                            <LALRAction SymbolIndex="6" Action="2" Value="0"/>
                            <LALRAction SymbolIndex="7" Action="2" Value="0"/>
                    </LALRState>
                    <LALRState Index="2" ActionCount="3">
                            <LALRAction SymbolIndex="0" Action="2" Value="1"/>
                            <LALRAction SymbolIndex="6" Action="2" Value="1"/>
                            <LALRAction SymbolIndex="7" Action="2" Value="1"/>
                    </LALRState>
                    <LALRState Index="3" ActionCount="1">
                            <LALRAction SymbolIndex="0" Action="4" Value="0"/>
                    </LALRState>
                    <LALRState Index="4" ActionCount="3">
                            <LALRAction SymbolIndex="0" Action="2" Value="5"/>
                            <LALRAction SymbolIndex="6" Action="2" Value="5"/>
                            <LALRAction SymbolIndex="7" Action="2" Value="5"/>
                    </LALRState>
                    <LALRState Index="5" ActionCount="7">
                            <LALRAction SymbolIndex="6" Action="1" Value="1"/>
                            <LALRAction SymbolIndex="7" Action="1" Value="2"/>
                            <LALRAction SymbolIndex="8" Action="3" Value="7"/>
                            <LALRAction SymbolIndex="9" Action="3" Value="4"/>
                            <LALRAction SymbolIndex="10" Action="3" Value="5"/>
                            <LALRAction SymbolIndex="11" Action="3" Value="6"/>
                            <LALRAction SymbolIndex="0" Action="2" Value="3"/>
                    </LALRState>
                    <LALRState Index="6" ActionCount="3">
                            <LALRAction SymbolIndex="0" Action="2" Value="4"/>
                            <LALRAction SymbolIndex="6" Action="2" Value="4"/>
                            <LALRAction SymbolIndex="7" Action="2" Value="4"/>
                    </LALRState>
                    <LALRState Index="7" ActionCount="1">
                            <LALRAction SymbolIndex="0" Action="2" Value="2"/>
                    </LALRState>
            </LALRTable>
    </Tables>
    

    XML as human readable format is self explanatory, you have access to all tables : Symbol, Rule, DFA and LALR and that’s it.

    Of course, cooking a “pgt” file (program template) is the usual way to process “cgt” or even write some extract utility for the purpose on top of a Gold Engine.

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

Sidebar

Related Questions

Let's say I have a grammar defined to something like: some_rule := a b
I have defined my Enums like this. public enum UserType { RESELLER(Reseller), SERVICE_MANAGER(Manager), HOST(Host);
I have defined an EnumRule like following in my Xtext grammar file: enum MySpec_directionEnum:
I have a relatively simple DSL that I would like to handle more robustly
I have defined a tag with a CSS attribute overflow set to scroll. This
I have defined a custom IPrincipal and custom IIdentity based on a website that
I have defined a fieldset in HTML, and applied the following (simple) CSS rules
I have defined a small DSL that is mostly written in the form of
So we have defined a set of API's that end users (functional folks precisely)
I've been trying to create a parser using simpleparse. I've defined the grammar like

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.