yacc, same token

Discussion in 'C Programming' started by cmk128@hotmail.com, Dec 23, 2005.

  1. Guest

    Hi All

    Here is my .l file, when the input is '1', the token will match mame,
    but sometime i want it matches "values". how to?

    chars [A-za-z0-9\_\'\.\"]
    int [0-9]+
    string \"{chars}+\"
    words {chars}+
    values {int}|{string}|{bool}
    name [a-zA-Z0-9]+

    thanks
    from Peter ()
     
    , Dec 23, 2005
    #1
    1. Advertisements

  2. wrote:
    > Hi All
    >
    > Here is my .l file, when the input is '1', the token will match mame,
    > but sometime i want it matches "values". how to?
    >
    > chars [A-za-z0-9\_\'\.\"]
    > int [0-9]+
    > string \"{chars}+\"
    > words {chars}+
    > values {int}|{string}|{bool}
    > name [a-zA-Z0-9]+
    >
    > thanks
    > from Peter ()
    >

    Well, how do you distinguish between a name and a value? (Perhaps you
    shouldn't allow a number to be a name)

    Robert
     
    Robert Harris, Dec 23, 2005
    #2
    1. Advertisements

  3. Flash Gordon Guest

    wrote:
    > Hi All
    >
    > Here is my .l file, when the input is '1', the token will match mame,
    > but sometime i want it matches "values". how to?


    <snip>

    Yacc is not C, please ask somewhere yacc is topical, not here.
    --
    Flash Gordon
    Living in interesting times.
    Although my email address says spam, it is real and I read it.
     
    Flash Gordon, Dec 23, 2005
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. exits funnel

    Parsing - YACC to java

    exits funnel, Jul 31, 2003, in forum: Java
    Replies:
    3
    Views:
    5,918
    exits funnel
    Jul 31, 2003
  2. Mike Wahler
    Replies:
    2
    Views:
    675
    John Harrison
    Jul 8, 2003
  3. Moonlit

    Best lex/yacc for C++?

    Moonlit, Oct 8, 2003, in forum: C++
    Replies:
    18
    Views:
    1,762
    Moonlit
    Oct 14, 2003
  4. Arthur T. Murray

    Re: Parsing English with lex and yacc

    Arthur T. Murray, Jan 23, 2004, in forum: C++
    Replies:
    5
    Views:
    1,784
    Amnon Meyers
    Jan 26, 2004
  5. Cronus
    Replies:
    1
    Views:
    916
    Paul Mensonides
    Jul 15, 2004
  6. G Fernandes
    Replies:
    1
    Views:
    689
  7. Wessi
    Replies:
    3
    Views:
    1,080
    Lawrence Kirby
    Aug 11, 2005
  8. =?Utf-8?B?Y2FzaGRlc2ttYWM=?=

    This is an unexpected token. The expected token is 'NAME'

    =?Utf-8?B?Y2FzaGRlc2ttYWM=?=, Jul 13, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    1,033
    =?Utf-8?B?Y2FzaGRlc2ttYWM=?=
    Jul 13, 2007
Loading...