1
/***************************************************************************
2
kgrammar.h - description
5
copyright : (C) 2000 by Ter�k Zsolt
6
email : tz124@hszk.bme.hu
7
***************************************************************************/
9
/***************************************************************************
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
16
***************************************************************************/
30
/**Context-free grammar for Kaptain.
35
QDict<int> nonterminals;
36
QList<QString> terminals;
40
/* The number of the last nonterminal symbol stored, the first is -1, decreasing */
42
/* The number of the next terminal symbol stored, starting with 0, increasing */
48
/* get the rule for the given non-terminal */
50
KRule * getTopLevelRule();
51
KRule * getStartRule();
53
/* check if a nonterminal has already been stored */
54
bool isNonterminal(QString *);
55
/* get the internal number for a non-terminal symbol */
56
int storeNonterminal(QString *);
57
/* get the internal number for a terminal symbol */
58
int storeTerminal(QString *);
60
/* get value for non-terminal */
61
QString getNonterminal(int);
62
/* get value for terminal */
63
QString getTerminal(int);
65
/* get a number for a non-terminal which has no name */
66
int getNewNonterminal();
68
void addRule(KRule *);
71
bool parse(const char * fname);