what '% token ' means and preprocessor directive # line

This is a discussion on what '% token ' means and preprocessor directive # line within the Tech Board forums, part of the Community Boards category; Hello , In one of the open source tools, CASPIAN, C code contains somethin like this. Code: %token <strval> STRING ...

  1. #1
    Registered User
    Join Date
    Jul 2006
    Posts
    22

    what '% token ' means and preprocessor directive # line

    Hello ,
    In one of the open source tools, CASPIAN, C code contains somethin like this.
    Code:
    %token <strval> STRING //line 455
    %token <realval> REALNUM
    %left <comptype> '>'
    %token ABSTRACTION
    Then in other c file i make call like
    # line 455 "cases49"

    what does this means here! what kind of preprocesor directive it is?

    regards
    nitin

  2. #2
    Registered User
    Join Date
    Jul 2006
    Posts
    22
    i have found some information in GNU site
    http://gcc.gnu.org/onlinedocs/cpp/Li...l#Line-Control.
    It do talk about such thing. Still trying to find out morre information

  3. #3
    ZuK
    ZuK is offline
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    This isn't c-source. It looks more like source code for a parser generator like yacc/bison.
    Usually this kind of code is converted to c code by the parser generator.
    That #line directive is usually used to refer to a specific line number in the parser source. This way the c compiler can emit error messages that refer to the original parser source when compiling the c-code.
    Kurt

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21