parsing

Pierre-Frédéric Caillaud peufeu at free.fr
Wed Jun 23 17:07:55 EDT 2004


	Try YAML

	http://yaml.org/

	Example YAML file from their site :

	import yaml
	yaml.load( data below )
	et voilà... it's done...

	read the site, it's really worth a look. This format is great for data  
serialization, and very human-readable unlike XML.

invoice: 34843
date   : 2001-01-23
bill-to: &id001
     given  : Chris
     family : Dumars
     address:
         lines: |
             458 Walkman Dr.
             Suite #292
         city    : Royal Oak
         state   : MI
         postal  : 48046
ship-to: *id001
product:
     - sku         : BL394D
       quantity    : 4
       description : Basketball
       price       : 450.00
     - sku         : BL4438H
       quantity    : 1
       description : Super Hoop
       price       : 2392.00
tax  : 251.42
total: 4443.52
comments: >
     Late afternoon is best.
     Backup contact is Nancy
     Billsmer @ 338-4338.



>
> I would like to use Python to parse a *python-like* data description  
> language.  That is, it would have it's own keywords, but would have a  
> syntax like Python.  For instance:
>
> Ob1 ('A'):
>     Ob2 ('B'):
>         Ob3 ('D')
>         Ob3 ('E')
>     Ob2 ('C')
>
> I'm looking for the ':' and indentation to provide nested execution so I  
> can use a description like the one above to construct an object tree.
>
> In looking at the parser and tokenize sections of the Python Language  
> Services (http://docs.python.org/lib/language.html), it looks as though  
> this will only parse Python keywords.  Is there a way to tap into Python  
> parsing at a lower level so that I can use it to parse my own keywords?
>
> Thanks,
> Todd Moyer
>
>
>
>



-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/



More information about the Python-list mailing list