Python lexical scanner

C

cricket

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top