Abstract syntax trees are represented as strings in the web API. To make them
easier to manipulate in JavaScript, the new function converts them to JSON.
To support structural editing, the nodes are numbered in the same way as in
the bracketed string created when linearizing an abstract syntax tree.
Example: "Pred (That Fish) Fresh" is converted to
{fun:"Pred",fid:3,
children:[{fun:"That",fid:1,
children:[{fun:"Fish",fid:0}]},
{fun:"Fresh",fid:2}]}
+ Make room for function names in the BracketedString data structure.
+ Fill in function names when linearizing an abstract syntax tree to a
BracketedString.
+ Fill in wildCId when it is not obvious what the function is.
+ Function bracketedLinearize: for compatibility with the other linearization
functions, return Leaf "" instead of error "cannot linearize".
+ Export flattenBracketedString from module PGF.
+ PGFServce: make function names available in the JSON representation of
BracketedString.
To get JSON output, add the parameter format=json. The JSON structure contains
the output from the function PGF.browse.
The default is format=html for backwards compatibility.
+ The flag fastcgi is removed: building the fastcgi is the main purpose of
this cabal file again.
+ pgf-http superseded by gf-server, but is still available as an option
+ Require cgi>=3001.7.3 instead of cgi>=3001.8.0.
"gf -server" mode now includes PGF service and the services to support
example-based grammar writing. (But gf -server is not quite ready to replace
pgf-http yet...)
Also bumped GF version number to 3.2.10-darcs
This was a bug in my workaround for a bug in the httpd-shed package. It
made it impossible to use the glue token "&+" for Turkish input in the minibar,
for example.
concrete language whose name ends with LaTeX.
This change also avoids duplicating output and, in addition to the linearize
command, applies the transfer also when using the linearizeAll command.
pgf-service now appears to works with Apache mod_fastcgi (under Mac OS X) in
addition to lighttpd.
One difference appears to be that while lighttpd passes the name of the PGF
file in the SCRIPT_FILENAME variable, Apache passes it in PATH_TRANSLATED.
But perhaps this depends on exactly how the fastcgi service is configured.
The following is what I added to the Apache configuration file to test this:
<Directory /Library/WebServer/Documents/fcgi-bin>
SetHandler fastcgi-script
Options +ExecCGI
</Directory>
Action pgf-service /fcgi-bin/pgf-service
AddHandler pgf-service .pgf
* Use cabal install -ffastcgi to compile the fastcgi server.
* Use cabal install -fcontent to compile the content service (off by default,
currently broken)
* Use both flag to compile both.
If you want the fastcgi server, use cabal install -ffastcgi.
This is to avoid problems when you only want to compile pgf-http and the
fastcgi library fails to install, which it usually does, since it depends on
a C library which is not installed automatically with cabal.
Along with the changes to Setup.hs it should now be enough to do
cabal install
pgf-http
open http://localhost:41296/
to run the PGF service locally and play with some example grammars in minibar.
The dependency on the fastcgi package made pgf-server difficult to compile, so
it is now split into
- pgf-fgci (main module in pgf-fcgi.hs), which is built only if fastcgi is
already installed or if you turn on the fastcgi flag (e.g. by doing
'cabal install -f fastcgi').
- pgf-http (main module in pgf-http.hs) which is always built (and hopefully
has no problematic dependencies.)
The modules FastCGIUtils and PGFService no longer depend on fastcgi.
+ PGFService.hs: add Nothing arguments in calls to PGF.parse_ and
PGF.getPArseOutput
+ gf-server.cabal: mark content-server as not buildable, since required source
files are missing.
When pfg-server servers a static file in HTTP mode, it is output as is, so
specifying charset="iso-8859-1" could be wrong.
Note: the a charset can be specified with a meta tag in HTML files,
e.g. for files in UTF-8:
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
pgf-server can now act as a standalone HTTP server. To activate this mode,
start it with
pfg-server http
to use the default port number (41296), or give an explicit port number, e.g.,
pgf-server http 8080
The HTTP server serves PGF files in the same way as the old FastCGI interface.
In addition, it also serves static files. The document root for static files
is the www subdirectory of the current directory where pgf-server is started.
In spite of these addition, backwards compatibility is maintaned. The old
FastCGI interface continues to work as before. (It is activated when
pgf-server is started without arguments.)