Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Compilers LCC > Re: yacc troubl...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 4 Topic 954 of 1070
Post > Topic >>

Re: yacc trouble

by toby <toby@[EMAIL PROTECTED] > Jun 3, 2007 at 07:49 AM

On May 31, 10:29 pm, Mohitz <coolmoh...@[EMAIL PROTECTED]
> wrote:
> Hi Guys,
>
> I am facing a peculiar problem with my yacc script. Following is the
> snippet of the yacc script that i am using.
> I am using lex as the lexical analyzer.
>
> Sample Input :
>
> create template {
>         with attributes :
>               attr1 ;
>               attr2 ;
>               attr3 ;}
>
> tpl_name
>
> Output that i get should be ideally
>
> Attribute name is attr1
> Attribute name is attr2
> Attribute name is attr3
>
> But what i get is
>
> Attribute name is attr1 ;
> Attribute name is attr2 ;
> Attribute name is attr3 ;
>
> Look at the semicolon appearing at the end. Does someone know why this
> happens? Would be glad to furnish more information if needed.

Can I see your lex source?

By default, lex copies unrecognised characters to output. This doesn't
seem to be the problem in your case (because ';' is a token), but it's
hard to be certain without seeing the lex source. It may help
debugging if you add a catchall rule at the end of your lexer:

..       printf("bad char: '%c'\n", yytext[0]);

>
> Thanks in advance
> Mohit
>
> The Yacc Script Snippet ...
 




 4 Posts in Topic:
yacc trouble
Mohitz <coolmohitz@[EM  2007-06-01 01:29:45 
Re: yacc trouble
toby <toby@[EMAIL PROT  2007-06-03 07:49:11 
Re: yacc trouble
Mohitz <coolmohitz@[EM  2007-06-03 18:13:58 
Re: yacc trouble
Mohitz <coolmohitz@[EM  2007-06-03 21:18:08 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 18:34:50 CDT 2008.