Re: rules never reduced
Hello Predrag,
Friday, January 6, 2006, 11:46:57 PM, you wrote:
> E ovo je verovatno glupo ali yacc mi za ovo vraca 8 rules never reduced.
> pomagajte zasto samo prvo pravilo prolazi .
> %token PROGRAM VAR CONST ID NUM STRING INT CHAR
> %%
> ZSAprogram : PROGRAM ime_program ';'
> ime_program : STRING // ovo prodje
> // e ovo nadalje mi uopste ne prolazi cak i kad bih stavio samo var_dec: VAR csv ';'
> csv : ID prijavi 2 rules never reduced
> var_decl : VAR type csv ';'
> csv : csv ',' ID
> csv : ID
> const_decl : CONST type csv_const ';'
> csv_const : csv_const ',' ID '=' NUM
> csv_const : ID '=' NUM
> type : INT
> type : CHAR
Problem je sto yacc mora da ima nacin da sve neterminale na kraju svede na jedan
pocetni. Tebi je pocetni neterminal ZSAprogram a var_decl i sve ostalo se ne
pojavljuje u smenama koje mogu da dovedu do ZSAprogam. Dakle samo ti fali veza,
npr.
ZSAprogram : PROGRAM ime_program ';' ostalo
ostalo : var_decl
ostalo : const_decl
...
--
Best regards,
Igor mailto:stojkovic7@verat.net
Friday, January 6, 2006, 11:46:57 PM, you wrote:
> E ovo je verovatno glupo ali yacc mi za ovo vraca 8 rules never reduced.
> pomagajte zasto samo prvo pravilo prolazi .
> %token PROGRAM VAR CONST ID NUM STRING INT CHAR
> %%
> ZSAprogram : PROGRAM ime_program ';'
> ime_program : STRING // ovo prodje
> // e ovo nadalje mi uopste ne prolazi cak i kad bih stavio samo var_dec: VAR csv ';'
> csv : ID prijavi 2 rules never reduced
> var_decl : VAR type csv ';'
> csv : csv ',' ID
> csv : ID
> const_decl : CONST type csv_const ';'
> csv_const : csv_const ',' ID '=' NUM
> csv_const : ID '=' NUM
> type : INT
> type : CHAR
Problem je sto yacc mora da ima nacin da sve neterminale na kraju svede na jedan
pocetni. Tebi je pocetni neterminal ZSAprogram a var_decl i sve ostalo se ne
pojavljuje u smenama koje mogu da dovedu do ZSAprogam. Dakle samo ti fali veza,
npr.
ZSAprogram : PROGRAM ime_program ';' ostalo
ostalo : var_decl
ostalo : const_decl
...
--
Best regards,
Igor mailto:stojkovic7@verat.net
- Follow-Ups:
- Re: rules never reduced
- From: Predrag Popovic <popovic_predrag@yahoo.com>
- Re: rules never reduced
- References:
- rules never reduced
- From: Predrag Popovic <popovic_predrag@yahoo.com>
- rules never reduced
Previous by date: Re: Jos par pitanja za asistenta
Next by date: Izmene mikrojave ispravke
Previous by thread: rules never reduced Next by thread: Re: rules never reduced
Previous by thread: rules never reduced Next by thread: Re: rules never reduced