[SimpleParse] How to process the tree?
Brought to you by:
mcfletch
|
From: Martin d'A. <Mar...@s2...> - 2003-07-17 22:08:42
|
Hi,
I have got the following program which works very well, but does not do
anything useful after it produces a correct taglist:
import os
from sys import stdin, stdout, stderr
from simpleparse import generator
from simpleparse.common import comments, numbers
from mx.TextTools import TextTools
import pprint
input = stdin.read()
decl = open('pif_works.def').read()
parser = generator.buildParser(decl).parserbyname('source_text')
taglist = TextTools.tag(input, parser)
pprint.pprint(taglist)
Now I want to create 4 different output formats (HTML and LaTeX are two of
them).
I tried to subclass the DispatchProcessor, and added a function for each
production I had (with a simple print statement in each one). I
instantiated MyProcessor class once. Now I don't now what to do. What
function should I call to get the ball rolling?
I have read the examples in simpleparse/common as recommended, but I just
don't see how tree processing gets started.
Thanks,
Martin
|