[Compiler-sig] Parser Options

LD Landis ldl@LDL.HealthPartners.COM
Tue, 31 Oct 2000 19:23:47 -0600 (CST)


Hi,

  I am working on another project that has the need for (preferably)
  a grammar driven parser.  I've looked at the approaches the CPython,
  JPython and Python.net have taken to this problem, and am thinking
  that there should be a way to generate some 'target language independent'
  scheme for parser generation.

  Also, I find something more along the lines of an Earley algorithm
  quite interesting (recently found the Accent Compiler Compiler), so
  am looking at how that all works, in general.

  So, my question is sort of along the lines: Guido, have you thought
  about, have pointers to ideas, etc, a way to unify the Python language
  grammar over the now-three implementations?

  The current approaches seem to be lacking nice connectivity between
  AST generation and rule "reduce" actions... It seems that it could be
  possible to generate some sort of an intermediary level that would
  handle (abstractly) the "action code" specification... so that a 
  separate "back end" could generate low-level (C, Python, Net-C-variant)
  code (bindings?).

  I am somewhat interested/motivated to look at this issue, but am not
  interested in starting a duplicate path... would rather hitch up with
  others that have thought longer about the problems.  I have no real
  experience in anything beyond serious yacc/lex hacking (no attribute
  grammar usage... only read about them)...
  
  I want the "tool" to be useful in my other interest, which has some
  keywordish/context sensitivity too... and would like to see the Python
  compiler world benefit as well.  For example, ideas on how to allow
  parsing of a "[<command>[ <options>]]+<nl>" language, where things are 
  context dependent:

     FOR I=0:1:31,127 SET X="WRITE "_I XECUTE X IF I%5=0 WRITE !

  which can equivalently be written:

     F I=0:1:31,127 S X="WRITE "_I X X I I%5=0 W !

  In [<command> <options>] ([C O] below) pairing is:

     F I=0:1:31,127   S X="WRITE "_I   X X   I I%5=0   W !
    [C OOOOOOOOOOOO] [C OOOOOOOOOOOO] [C O] [C OOOOO] [C O]

  TIA for any discussion/pointers/ideas!

Cheers,
	--ldl