[Q]? Wrong $1 Value with Roskind grammer

Patrick Baechler <pbaechle@itr.ch>
Tue, 18 Apr 1995 05:14:00 GMT

          From comp.compilers

Related articles
[Q]? Wrong $1 Value with Roskind grammer pbaechle@itr.ch (Patrick Baechler) (1995-04-18)
Re: [Q]? Wrong $1 Value with Roskind grammer jar@iapp201.mcom.com (Jim Roskind) (1995-04-28)
| List of all articles for this month |
Newsgroups: comp.compilers,comp.lang.c++
From: Patrick Baechler <pbaechle@itr.ch>
Keywords: C++, parse, question
Organization: ITR (Interkantonales Technikum Rapperswil)
Date: Tue, 18 Apr 1995 05:14:00 GMT

Hi


I tried to get the IDENTIFIER names from a C/C++ File like follow ...


main()
{
    int a,b;
    a = 5;
}


.. so I put an action after the concerned reduction like this ...


rescoped.identifier:
IDENTIFIER { printf("IDENTIFIER = '%s'\n", $1); }


| operator.function.name


                | class.rescoped.identifier
                ;


.. after that the output looked like this ...


IDENTIFIER = 'a'
IDENTIFIER = 'b'
IDENTIFIER = '='


Please note: - the cutting is a part from the Roskind cpp4.y grammer.
- I didn't want to get the names from all IDENTIFIER's,
only the simple-ones like above.
- the program is originated from cpp4.l (LEXFILE ROSKIND)
cpp4.y (YACCFILE ROSKIND)
- I had the same problem with: YACC/LEX, YACC/FLEX, BYACC/LEX




Im happy about every advice !
Thanks for your endevour.


Patrick <pbaechle@sky.itr.ch>
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.