python LEX

J

jozo

I have to work on python lexical definition in Lex. I spent lots of my
time to find regular expresions written for Lex of Python language but
nothing.
Can somebody help me?

I nEED hELP
 
M

Miki Tebeka

Hello jozo,
I have to work on python lexical definition in Lex. I spent lots of my
time to find regular expresions written for Lex of Python language but
nothing.
Can somebody help me?
http://www.antlr.org/grammar/list (search for Python)

You can search in projects like Pyrex and Parrot for their parser
implementation.

HTH.
--
------------------------------------------------------------------------
Miki Tebeka <[email protected]>
http://tebeka.bizhat.com
The only difference between children and adults is the price of the toys

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Cygwin)

iD8DBQFCZ4ln8jAdENsUuJsRAvKpAKCNzBlmhqRA9gtx+wdBdrK1S1FwEwCguN75
Ju9j7b7ud+STGimTrYsFpyc=
=Cizb
-----END PGP SIGNATURE-----
 
M

Maurice LING

jozo said:
I have to work on python lexical definition in Lex. I spent lots of my
time to find regular expresions written for Lex of Python language but
nothing.
Can somebody help me?

I nEED hELP

Jython has a Python language lexer written using JavaCC.
 
M

Mike Meyer

Miki Tebeka said:
Hello jozo,

http://www.antlr.org/grammar/list (search for Python)

You can search in projects like Pyrex and Parrot for their parser
implementation.

The python grammar is included with the Python sources, and is used
to build the compiler.

Trouble is, he wants a lexer, not a parser. The lexer in the sources
is an ad-hoc package, contained in Parser/tokenizer.c.

<mike
 
M

Michael Spencer

Mike Meyer wrote:

....
Trouble is, he wants a lexer, not a parser. The lexer in the sources
is an ad-hoc package, contained in Parser/tokenizer.c.

<mike

There is also tokenize.py in the standard library, which might be an easier
reference

"""
....
It is designed to match the working of the Python tokenizer exactly, except
that it produces COMMENT tokens for comments and gives type OP for all
operators
....
"""

Michael
 

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

Similar Threads

Lex 2
Need Help with Repository Program (Beginner) 1
Lex Python 0
lex 2
Regular expresions 1
to free() or not to free() in lex/yacc 13
New to python 4
How do I solidify my Python skills 1

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top