Index of /wikiparser
      Name                    Last modified       Size  Description

[DIR] Parent Directory 23-May-2010 17:53 - [TXT] setup.py 24-Aug-2004 14:58 1k [TXT] testwiki.py 24-Aug-2004 14:58 4k [TXT] wiki.c 24-Aug-2004 14:58 128k [TXT] wiki.py 24-Aug-2004 14:57 54k [   ] wikishort.bgen 24-Aug-2004 14:58 33k

= Getting started =

To get started, you don't need anything but wiki.py, and maybe 
testwiki.py to test it. Simply run "python testwiki.py".
To get an interactive parser prompt, simply run "python wiki.py".
This will only do one line at a time though.

== Compiling the C module ==
To get the full speed, you want to build and install the C module. 
You need distutils and python2.3 (with dev files) installed.
In the wiki parser dir, run (possibly as root):

 python setup.py install

This will compile the module and install it in the python lib dir

To test the C version, do this at the beginning of testwiki.py:

import wikic
def Run(text):
    parser = wikic.new(0)

and invoke the test run with python testwiki.py

For the pure python version (wiki.py), use this code instead:

import wiki
def Run(text):
    parser = wiki.new(0)

Of course in production something like this will be used:

    try:
        import wikic
        parser = wikic.new(1)
        print 'Using C parser'
    except:
        import wiki
        parser = wiki.new(1)
        print 'Using Python parser'

== Generating wiki.py and wiki.c from the spec file (wikishort.bgen) ==
After modifying the grammar spec in wikishort.bgen, you need to regenerate
wiki.py and wiki.c using BisonGen.
Get BisonGen 0.7 from ftp://ftp.fourthought.com/pub/BisonGen/

untar it and run "python setup.py install"

In the same dir as wikishort.bgen, run

BisonGen wikishort.bgen

Now wiki.c and wiki.py should be up to date. To install the new C module, 
run "python setup.py install" again.