Perl-Sensitive Sunglasses | |
PerlMonks |
Re: Parsing a macro languageby cmeyer (Pilgrim) |
on Jul 08, 2005 at 23:58 UTC ( [id://473617]=note: print w/replies, xml ) | Need Help?? |
Consider using an existing data serialization language. I enjoy using YAML for configuration information or other external data. It's advantages are that it is easy to read and write with any text editor, the syntax is fairly intuitive (it looks a lot like outlines done in email), and there are decent parsers and emitters for many common languages, including Perl (YAML). One of the very nice things about YAML is that it is a direct representation of scalar, array and hash data structures, nested arbitrarily. This means that the language is rich enough to represent any data structure that you can in Perl (or Python, Ruby, JavaScript, PHP, etc.). It also means that you don't have to perform interesting data contortions (or use objects, tree structures, etc.), as you might with XML. Rather, you use the structure directly. It's an AoHoAoH, or what ever you like. Your data in YAML might look like:The Perl data structure looks like this:
-Colin. WHITEPAGES.COM | INC
In Section
Seekers of Perl Wisdom
|
|