Python lexical scanner

Discussion in 'Python' started by cricket, Sep 25, 2003.

  1. cricket

    cricket Guest

    i need help with Python lexical scanner for this assignment, i have
    create a scanner using the Flex scanner generating tool. The
    requirements of the scanner are as follows:

    1) Accept input via stdin (standard input).
    2) Return output via stdout (standard output)
    3) Recognize tokens of the Python programming language
    3.1) Tokens are grouped into the following categories:
    Newline
    Indent
    Identifiers
    Keywords
    Literals
    Operators
    Delimiters
    For INDENT tokens, the format should be

    <#> - INDENT - <indent level>


    i need help with INDENT,Literals and Newline every time i used \n for
    newline it did not work i even used [\n] still did not work.
    The scanner should output the tokens discovered in the form:

    <#> - <token category> - <token spelling>
    for example
    10 keyword while or if



    Thank you
     
    cricket, Sep 25, 2003
    #1
    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. GMane Python

    Scanner Access in Python

    GMane Python, Apr 13, 2005, in forum: Python
    Replies:
    0
    Views:
    680
    GMane Python
    Apr 13, 2005
  2. dwelch
    Replies:
    1
    Views:
    588
    Lonnie Princehouse
    Mar 29, 2006
  3. Replies:
    0
    Views:
    368
  4. Matt Barnicle
    Replies:
    10
    Views:
    791
    Bruno Desthuilliers
    Dec 2, 2007
  5. globalrev

    python: lexical or dynamic scope?

    globalrev, May 13, 2008, in forum: Python
    Replies:
    3
    Views:
    989
    Mark Wooding
    May 14, 2008
  6. Replies:
    3
    Views:
    837
    Paul McGuire
    Mar 11, 2009
  7. Andrew Savige

    Lexical scope: converting Perl to Python

    Andrew Savige, Jun 13, 2009, in forum: Python
    Replies:
    3
    Views:
    582
    John S
    Jun 13, 2009
  8. Chris Seberino
    Replies:
    1
    Views:
    626
    Hao Lian
    Sep 12, 2009
Loading...