[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SEUL: Parsely announcements: Draft 1




Hello, all.  Here are the first drafts of some announcements I want to
send out about my project, Parsely.  (See http://parsely.seul.org/).

If you have time, I'd like feedback about the announcements.  I'm
aiming and hackers and developers here -- I want them as interested as
possible.

I've also got some specific questions about specific parts of the
announcements.  I've marked them with "***", and put them on separate
lines.

Many thanks,
			Nick

================================================================1 Line

Parsely: A tool for writing configuration tools

Parsely: A cross-language tool for parsing and file manipulation

Parsely: A cross-language tool for configuration file parsing and manipulation

***Which, if any, is best?

=============================================================Freshmeat

Parsely is a general back-end for programmers writing configuration
tools.  It exposes programmer-friendly interfaces to nearly any
text-based file format, so that all you need to write are the
front-ends.  Parsely manipulates configuration without disturbing
their whitespace or formatting.

Python/pcre/SPARK support is complete, alpha-tested and ready for a
public beta.  C/flex/Bison support is 50% done, and should be available for
testing by the end of May.

***Which details are missing?  

         [At the very least, I need to mention that you can write
         grammars for new formats.  I don't know how to say this.
  
         I also want to make it clear that this isn't a complete
         configuration tool (like the Linuxconf backend) but just a
         component of one.  I don't know how to say this either.
 
         Finally, I want to mention that it's cross-language and
         cross-scanner, and cross-parser.  This also eludes me.]

***Which details are gratuitous?  [Perhaps the pcre/SPARK/flex/Bison
         stuff... but I want people to know it isn't a new parser, but
         an interface to all the old parsers.]

***How can I make the right people want to hack this?

======================================================================

ANNOUNCEMENT: Parsely 0.1.0

Parsely is a general back-end for programmers writing configuration
tools.  It exposes programmer-friendly interfaces to various file
formats, so that all you need to write are the front-end.

Here's how it works:

    1. You, the programmer, decide you want to write a tool that
       manipulates a given file format.
       
    2. You write a grammar file describing the file format. For a set
       of extremely simple examples, look in tests/*.ply.

    3. Parsely reads the grammar file, and writes a scanner/parser for
       you in the language of your choice.  (Python support is
       complete; C support is about 50% done.  C++ and perl are down
       the pipe.)

    4. Later, your program can use the generated scanner to parse
       files into an easily-manipulated tree structure. It can examine
       and modify the tree structure, and later write its changes back
       out to disk, preserving all comments and formatting.

Parsely doesn't try to reinvent the wheel; it interfaces with scanner-
and parser- generators like flex and bison, rather than trying to
generate efficient C scanners and parsers itself.

STATUS:

Parsely is written and documented.  You can download Parsely or browse
its documentation at http://parsely.seul.org

Please be aware that this is a hackers-only release: you'll probably
need to know a fair amount about Python to get it to work.

FEATURES:

***I should write a feature list here.  Which features from the web page/
   documentation seem most interesting to you?

EXAMPLE:

***Should this section be here?  Is it enabling or intimidating?

Suppose you want to write an interface to files that look like this:

        # (save this file as 'kvl.example')
	[SectionName]
	Key1=Val1
	# Comment
	Key2 =  "A string"

	[AnotherSectionName]
	Key3= val2
	# and so on....

You start by writing a file description.  (The format is explained
more fully in the documentation.)

       # (save this file as 'kvl.ply')
       ##
       # First, you list all the tokens you care about.
       ##
       token '[';
       token ']';
       token '\n';
       token '=';
       token Word   = m/\w+/; # We proudly support Perl's regular expressions!
       token String = m/"([^"]|\\")*"/; 

       ##
       # Next, you list the kinds of space that appear in the file.
       ##
       space /\s+/;
       space /#.*$/; # Comments  count as space too.
       default space ''; # By default, don't insert space.

       ##
       # Last, you write a grammar for the file as a whole:
       ##
       start File;
       File        = Section *;  
       Section     = OptNewlines '[' Word:name ']' Newlines Lines:body ;
       Lines       = Line * ;
       Line        = Word:key '=' Word:val   Newlines |
                     Word:key '=' String:val Newlines ;
       Newlines    = '\n' +;
       OptNewlines = '\n' *;
 
Once you've written the file description, you can use Python to parse
and manipulate this kind of files.  In reality, you'd want to do this
behind a GUI, but we'll do a small example below:

       import parsely

       # Load the file format.
       kvl_format = parsely.loadFormat('kvl')

       # Read the example file
       file = kvl_format.parseFile('kvl.example')
       
       # Change the name of the second section
       file[1].name = 'NewName'
       
       # Insert a new entry into the first section
       file[0].body.append(
                   kvl_format.newNode('Line', 
			              ('NewKey', '=', 'NewVal', '\n'), ''))
       
       # Change the value of the first entry
       file[0].body[0].val = 'modifiedvalue'

       # Write the file back to disk
       file.flush()

Once you're done, the new file will reflect your changes, but be otherwise
identical:

       [SectionName]
       Key1=modifiedvalue
       # Comment
       Key2 =  "A string"

       NewKey=NewVal
       [NewName]
       Key3= val2
       # and so on....

PENDING TASKS and CALL FOR HACKERS:

Parsely is alpha software! I'm trying to finish my Master's thesis
now, but I should have a few hours here and there to hack on
Parsely. These are the tasks I hope to accomplish first.

    * There needs to be a real build and install process. Right now,
      this tool is hackers-only.
    * The documentation could use fleshing out. 
    * We need more examples. 
    * File includes need to work properly. 
    * There needs to be C support. 
    * I need testers to help push me towards a stable release. 

Most of all, I need good GUI hackers to help write graphical frontends
for the backends Parsely provides. Give Parsely a try in your own
configuration project! If you can't get it working yourself, drop me a
line, and I'll help you write the .ply files and the the syntax
manipulation code.

Parsely has the flexibility to handle everything from simple Key-value
files to XF86Config to bash and tcsh configurations. It can probably
help with your project too.

(In fact, it wouldn't be too hard to write a module to parse
sendmail.cf, if only I knew what to do with it...)

FOR MORE INFORMATION:

Please feel free to email me at nickm@mit.edu, or see the Parsely web
page at <http://www.parsely.org/> for screenshots, documentation, and
a mailinglist.

*** What else do I need to say?
===========================================================================