On Wed Jun 01, 2011 at 11:03:46AM +0200, Otto Moerbeek wrote:
> On Wed, Jun 01, 2011 at 10:54:05AM +0200, Rafael Sadowski wrote:
>
> > Hello @tech,
> >
> > I hope anybody can help my with my yacc rules/grammer. I can't find bugs
> > in my grammer. I think the problem is in the lexer but I have no idea,
> > how debug it. GDB tells me: "No Source Available" for yyparse (). Any
> > advice, how debug it? This is my first experience with YACC!
> >
> > Maybe any yacc/lex hacker has a minute to look over my parse.y. I am
> > grateful for any advice. My parse.y based on ospfd and relayd.
>
> Run yacc with -t and set yydebug = 1 in your code. That will reveal
> the tokens yacc sees and what it does with them.
>
> -Otto
>
Thanks Otto, this helped me a lot. Now, I'm one step big forward.
I found one (In my opinion) strangeness in my grammeri/rule. It is
important to declare the TOKEN in dependence to other TOKEN?
It will not work with following rule, if I change WIRELESSNAME to
NETMASK it works file. I don't know why, what is the different between
WIRELESSNAME and NETMASK?
wirelessoptsl : WIRELESSNAME STRING '{' {
}
| PRIORITY NUMBER optnl {
}
'}'
;
### my tokes:
%token NETWORK ETHERNETNAME WIRELESSNAME
%token BSSID CHANNEL DHCP DOMAINNAME DOMAINNAMESERVERS ERROR
%token INCLUDE INET INTERFACE YES
%token LLADDR MINSIGNAL NETMASK NWID NO PRIORITY RUNDOWN RUNUP
%token UPDATEINTERVAL WEP WEPKEY
%token WPA WPAAKMS WPACIPHERS WPAGROUPCIPHER WPAKEY
%token <v.string> STRING
%token <v.number> NUMBER
%type <v.string> string
### my keywords:
static const struct keywords keywords[] = {
{ "bssid", BSSID },
{ "channel", CHANNEL },
{ "dhcp", DHCP },
{ "domain-name", DOMAINNAME },
{ "domain-name-servers", DOMAINNAMESERVERS },
{ "error", ERROR },
{ "ethernet", ETHERNETNAME },
{ "include", INCLUDE },
{ "inet", INET },
{ "interface", INTERFACE },
{ "yes", YES },
{ "lladdr", LLADDR },
{ "minsignal", MINSIGNAL },
{ "netmask", NETMASK },
{ "network", NETWORK },
{ "nwid", NWID },
{ "no", NO },
{ "priority", PRIORITY },
{ "run-down", RUNDOWN },
{ "run-up", RUNUP },
{ "update_interval", UPDATEINTERVAL },
{ "wireless", WIRELESSNAME },
{ "wep", WEP},
{ "wepkey", WEPKEY},
{ "wpa", WPA},
{ "wpaakms", WPAAKMS },
{ "wpaciphers", WPACIPHERS },
{ "wpagroupcipher", WPAGROUPCIPHER },
{ "wpakey", WPAKEY }
};
const struct keywords *p;
### my config file (crashed with "wireless", works with "netmask"):
network local {
ethernet home {
priority 23
}
ethernet work {
priority 23
}
wireless park {
priority 23
}
}
--
http://www.sizeofvoid.org - [email protected]
XMPP: [email protected]
Key fingerprint: BDDD 91E9 28CB 3A52 3E99 61B0 C359 2691 BAC6 A3B1