johnf wrote:
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.

Pray tell: what is the other language, and why do you want to convert programs?

I assume you want to convert so you can then modify / extend the old programs. If you just plan to run them in Python "as is" I see no value in converting!

It is hard to map programs in other languages to Python because Python is so different. A direct translation would not take advantage of python's uniqueness.


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. 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.

FWIW I have written a parser for parts of the CMS Pipelines language. I provide a form of BNF for the syntax, generate parsers from that, run a "program" through that, which generates lists or dictionaries. I have no need to create a program from that.

The Pipelines language is very simple, so I am not dealing with control structures, just sequences of words and symbols.


--
Bob Gailer
Chapel Hill NC 919-636-4239

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to