Am Mon, 22 Dec 2008 07:18:41 -0800
schrieb johnf <jfabi...@yolo.com>:

> I've been in the programming business for over 20 years and I have
> never had a need for a parser.  But recently I have need to convert
> code from one language to a my new language python.  What a better
> way to learn the new language python than a new project.  I decided
> it might be time to learn a little something about parsers too.
> However, I soon discovered that I was walking into the world of
> compiler writers and theories of computer scientist.  I paid for and
> downloaded a paper from O'Reilly books on what I thought was going to
> be on 'pyparser'.  But that turned out to be mostly theory.  And
> nothing about the use of pyparser. 

Well, scanning and parsing are rather one of the older fields in C.S.

So if I got that correct you want to convert programs from language A
to language Python, and on tops you'll probably want the generated
program to be human-readable and as fast as possible.

Without knowing what A is, it's hard to tell you more, but writing a
parser for almost any programming language is hard, and emitting fast
and human readable code is even harder.

Furthermore, doing it without the theoretical background is not simpler
either.

Btw, possible implementations of a parser depend upon a number of
"theoretical" properties of the grammer you want to implement.

> 
> So I ask you guys is there a link to a practical tutorial that
> provides hands on information on the use of a python parser.  I'd
> like to see something that demo's converting a real language to
> python.  When I google parsers I have found a few simple code
> examples of parsing a float.  Not really much help (I could have done
> that using Regex) when you want to parse 'if,then' statements that
> can be recursive.

Take a look at the examples at the pyparsing website, it even includes
a python parser :)

Andreas
> 
> Thanks in advance.  
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to