[Python-Dev] relation between Python.asdl and Tools/compiler/ast.txt

2010-01-07 Thread Yoann Padioleau
Hi,

I would like to use astgen.py to generate python classes corresponding to the 
AST of something I have defined in a .asdl file, along the line of what is
apparently done for the python AST itself. I thought astgen.py would
take as an argument a .asdl file, but apparently it instead process a file
called ast.txt. Where does this file come from ? Is it generated from
Python.asdl ?

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] relation between Python.asdl and Tools/compiler/ast.txt

2010-01-07 Thread Yoann Padioleau

On Jan 7, 2010, at 12:31 PM, Martin v. Löwis wrote:

>> I would like to use astgen.py to generate python classes corresponding to 
>> the 
>> AST of something I have defined in a .asdl file, along the line of what is
>> apparently done for the python AST itself. I thought astgen.py would
>> take as an argument a .asdl file, but apparently it instead process a file
>> called ast.txt. Where does this file come from ? Is it generated from
>> Python.asdl ?
> 
> astgen.py is not used to process asdl files; ast.txt lives right next to
> astgen.py. Instead, the asdl file is processed by Parser/asdl_c.py.

Yes, I know that. That's why I asked about the relation between ast.txt and 
Python.adsl.
If internally the parser uses the .adsl, but expose as a reflection mechanism 
things
that were generated from ast.txt, then there could be a mismatch. Where does 
ast.txt comes from ? Shouldn't it be generated itself from Python.adsl ?

So we would have

Python.adsl > ast.txt  astgen.py --->  ast.py containing all 
the UnarySub, Expression, classes that represents a Python AST.



> 
> HTH,
> Martin

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] relation between Python.asdl and Tools/compiler/ast.txt

2010-01-08 Thread Yoann Padioleau

On Jan 7, 2010, at 1:16 PM, Martin v. Löwis wrote:

>>> astgen.py is not used to process asdl files; ast.txt lives right
>>> next to astgen.py. Instead, the asdl file is processed by
>>> Parser/asdl_c.py.
>> 
>> Yes, I know that. That's why I asked about the relation between
>> ast.txt and Python.adsl. If internally the parser uses the .adsl, but
>> expose as a reflection mechanism things that were generated from
>> ast.txt, then there could be a mismatch. Where does ast.txt comes
>> from ? Shouldn't it be generated itself from Python.adsl ?
> 
> What you may not be aware of is that Tools/compiler (and the
> compiler package that it builds on) are both unused and unmaintained.

I see. So if people want to analyze python code they have to use
other tools (like rope?) ? or use reflection ?

> 
> If the package stops working correctly - tough luck.
> 
>> So we would have
>> 
>> Python.adsl > ast.txt  astgen.py --->  ast.py
>> containing all the UnarySub, Expression, classes that represents a
>> Python AST.
> 
> No - what actually happens in Python 3.x is this: both the compiler
> package and Tools/compiler are removed.

Ok. I will then create my own ast classes generator.

Thanks.


> 
> Regards,
> Martin

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com