We don't bite newbies here... much | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Just WOW! Thank you very much for your responses! I had been away from Perl for a while, had not known about Marpa before. If you insist, I'll tell something about this. I had not done this before 1) in the interest of keeping my question short and 2) by fear of being told that this is already done, and way better than I am capable of. Which is exactly what's going to ensue now. Trust me. So be it. I am a lazy Computer Networks teacher. I want to have a minimalist language to describe a (computer) network topology and diagram layout. My idea is to cruft a file like
This would describe a simple network where a router is linked to two switches, S1 linked to hosts H1 and H2, and then S2, linked to H3. The first stances declare topology elements in association with some predefined icons. The middle part tells what's linked to what. The final line describes the diagram layout. In my mind "A;B" means A is graphically above B, and "A,B" means A is to the left of B. This final line is what I am trying to parse. After having the syntax tree I want to apply some simple algorithms to get the bounding box dimensions for each subtree and finally draw the graph with properly centered icons and links. I was not expecting binary trees as a result, I'll have to digest that. Maybe I'll be fine with them. Thank you again! In reply to Re^2: Parsing syntax trees
by betacentauri
|
|