[Doc-SIG] Formalizing ST

Peter Funk pf@artcom-gmbh.de
Sun, 25 Mar 2001 11:42:47 +0200 (MEST)


Hi,

Edward D. Loper schrieb:
> Hmm.. So I'm starting to think that EBNF really isn't the best
> formalism for capturing global formatting.  

Hmmmm..... I think I have to disagree.  What is global formatting?
Did you ever had a look at the Python/Grammar/Grammer file, which
is basically EBNF and uses the special Tokens INDENT and DEDENT?

I was thinking of something like this for ST:

structured_text: (headed_section | colored_text)*
colored_text: (colored_text_line NEWLINE | bullet_list | table | ....)
colored_text_line:  ....
bullet_list: bullet_item bullet_item*
bullet_item: ('*'|'-'|'o') colored_text_line [NEWLINE indented_colored_text]
indented_colored_text: INDENT colored_text+ DEDENT

headed_section:  headline section_body
headline: colored_text_line NEWLINE ('-'|'=')* NEWLINE

This is rather sketchy and not well thought out, but you might get
the basic idea.  Maybe even 'pgen' from the Python distribution can 
be reused for parsing formalized ST?

For simple implementation experiments John Aycocks spark might be
an alternative.  Look at the tokenize module from the Standard 
library.  I wish I would have the time to do this myself.  
Unfortunately I have not.

Regards, Peter
-- 
Peter Funk, Oldenburger Str.86, D-27777 Ganderkesee, Germany, Fax:+49 4222950260
office: +49 421 20419-0 (ArtCom GmbH, Grazer Str.8, D-28359 Bremen)