Lambda the Ultimate

inactiveTopic Scanning, Parsing, and Rewriting Kit - Python
started 5/18/2002; 3:30:49 AM - last post 8/20/2002; 1:13:06 PM
Ehud Lamm - Scanning, Parsing, and Rewriting Kit - Python  blueArrow
5/18/2002; 3:30:49 AM (reads: 1970, responses: 3)
Scanning, Parsing, and Rewriting Kit - Python
SPARK stands for the Scanning, Parsing, and Rewriting Kit. It formerly had no name, and was referred to as the "little language framework." The first version (circa 1998) was described in the paper Compiling Little Languages in Python at the 7th International Python Conference.

SPARK is written in 100% pure Python, and is made available as open source.

If you want to implement a DSL in Python, this may be a useful tool. Not very practical when efficiency is at stake, but for little languages this may very well be a solution.

The paper provides a decent tutorial, and explains the design of SPARK.

SPARK makes good use (?) of Python's reflection mechanism, which is another reason to take a look. The framework recognizes parsing and tokenizing methods and extracts their exact function from their docstrings (which may contain, for example, a parsing rule). I guess this qualifies as meta-data (which is something we discussed a couple of months ago).

If anyone built something interesting using SPARK, I'd love to see.


Posted to DSL by Ehud Lamm on 5/18/02; 3:32:06 AM

jon fernquest - Re: Scanning, Parsing, and Rewriting Kit - Python  blueArrow
5/22/2002; 10:29:53 PM (reads: 824, responses: 0)
A similar toolkit for Java but paired with a book that explains how to use, test, and extend it is:

Building Parsers with Java Steven John Metsker

http://www.aw.com/catalog/academic/product/1,4096,0201719622,00.html

The largest example, a graph plotting language, qualifies as a DSL ....I think.

Other example languages:

  • regular expression
  • logic language
  • query language

Ehud Lamm - Re: Scanning, Parsing, and Rewriting Kit - Python  blueArrow
8/20/2002; 1:13:06 PM (reads: 726, responses: 0)
IBM developerWorks: Charming Python: Parsing with the Spark module