Python grammer and student projects

Roman Meisl meisl at Mathematik.Uni-Marburg.de
Thu Jun 5 15:12:51 CEST 2003


Hello Michael,

Am 5 Jun 2003 um 4:48, schriebst Du (Michael Chermside):
> I am actually rather dubious of your claim that there are problems
> with the online-grammer. 
> [...]
> I wonder if you're looking at a the wrong document (perhaps an outdated
> one?) and there's a different (better) grammer specification someplace
> else. Or perhaps there are interpretation problems. What kinds of issues
> do you think you've found, and in what document?

There are - as far as I've seen - two grammar versions
First one can be accessed by
http://www.python.org/doc/current/ref/grammar.txt
within the Python Reference Manual
For example this grammar isn't describing the symbols 'test' and 
'testlist'. 
Further, by example following rule is correct but the fomulation is a 
bit sophisticated:
    or_expr ::= xor_expr | or_expr "|" xor_expr
Expressing the same with
    or_expr ::= xor_expr ( "|" xor_expr)*
would be easier to understand
Some rules are a bit redundant and could be written more efficiently 
(e. g. funcname ::= identifier)

The other version can be found within the sourcecode-package. As far as 
I've seen it is correct and formulations are less redundant and 
clearer.

The problem is, that the online-grammar (first one) is found at first 
(by newbies, like me)

> > I'm not learning python but I'm directing a students group which is
> > developing a python-compiler for practice.
> 
> Hey... that's exciting! I think it sounds like a great project.

Yes it is a great project, but only in the sense of meaning lot of work 
;-)

> Can you
> share any details? Who's working on this... what are their goals? 

I'm working to graduate as an scientific assistant at the Philipps-
University of Marburg at the Department of Mathematics and Computer 
Science.

This semester I've to conduct a lecture about compiler-building 
(german: Compilerbau) with some exercise. And this exercise tries to 
develop a hand-crafted Python compiler without using tools like lex and 
so on. My opinion is, that the resulting compiler can't compete by far 
with any other Python compiler, especially that from python.org. It's 
only for teaching the students how to develop a compiler "by hand" and 
how much work it is ;-)

> Are
> you just replacing the compiler (to produce python bytecode), or the
> interpreter as well? (Or do you really mean a Python compiler in the
> sense of python -> machine code?) 

The target isn't completely clear, yet. I think we wouldn't go as far 
to produce machine code, but we will see.

> I wonder if there's
> any chance of leveraging your students to contribute to contribute
> something to core cPython itself. Just idle speculation, but I always
> try to mention these kinds of things.

Well, I can ask them if they're eager. Can you tell something about the 
problems/work there?

> Yeah... one of Python's great strengths is the helpfulness of its
> community. Welcome.

Thank you, I appreciate that

> PS: Feel free to CC python-list with your reply if you think it'd
> be of general interest.

[x] Done. I don't know if it's of general interest, but we will see.

Bye,

   Roman



-- 
PGP-Key available
Kontakt: 
http://www.mathematik.uni-marburg.de/~meisl/kontakt.html






More information about the Python-list mailing list