# Re: [NTG-context] BNF grammar for ConTeXt (was: What happened with sectionworld?)

On Thu, 30 Apr 2009 10:57:04 +0200
luigi scarso <luigi.sca...@gmail.com> scribit:

> On Thu, Apr 30, 2009 at 10:16 AM, R. Bastian <rbast...@free.fr> wrote:
>
> > On Thu, 30 Apr 2009 09:48:40 +0200
> > luigi scarso <luigi.sca...@gmail.com> scribit:
> >
> > > R. Bastian:
> > >
> > > > CONTEXT_SOURCE ::= PREAMBLE "\starttext" TEXT "\stoptext" |
> > CONTEXT_SOURCE
> > > >>>  TEXT ::= STARTSTOPS | SETUPS | DEFINES | OTHERS [ TEXT
> > > >>
> > > >> luigi:
> > >
> > > >   To be general, i think
> > > >>   MY_CONTEXT_SOURCE ::= MACRO* END
> > > >>
> > > >
> > > R. Bastian:
> > >
> > > > I dont understand the sense of "\end\starttext"
> > >
> > > sense==semantic
> > >
> > > "\end""\starttext" is a valid string for a hypothetical  bnf grammar of
> > > ContTeXt
> > > which is not valid for your bnf ;
> > > "\end""\starttext""\stoptext" is in your bnf grammar
> > > and has the same semantic of  "\end""\starttext" .
> > >
> > > The point is : a bnf for Context can be hard to define
> > >
> > >
> > >  luigi:
> > >
> > > think that a bnf or lpeg grammar is really useful for a sort of
> > > >> standard-ConTeXt
> > > >> or minimal-ConTeXt or light-ConTeXt
> > > >> ie a ConTeXt to use as "reference"
> > > >>
> > > >
> > > R. Bastian:
> > >
> > > > Exactly what I need : standard, minimal and light
> > > >
> > >
> > > Exactly what can be hard to define and capture in a bnf .
> > >
> > > wolfgang
> > >
> > > >
> > > > How could a BNF grammar help to learn ConTeXt,
> > >
> > > a bnf can help to build a syntax checker, a highlighter etc.
> > > Actually the only way to say that you have a valid ConTeXt string
> > > is running context on that string .
> > >
> > > The semantic is another story.
> >
> > OK - but isn't it not worth to try it ?
> >
> sure, and I encourage you to go on and possibly write something x next
> eurotex.
>
> My suggestions to start :
> 1) define a **simple but significative** domain ,ie "this grammar is for
> subset of ConTeXt language dedicated to variable-data pdf forms"

yes

> 2) make a bnf grammar spec

yes

> 3) build a parser lex/yacc for 2)

later

> 4) make a lpeg grammar
> 5) user lpeg inside context for 3)
>
> PS
> it was just a coincidence , but for other reasons I have found this link
> http://martinfowler.com/dslwip/
>
> --
> luigi

I think a wiki would be a better forum than this mailing-list ?

___________________________________________________________________________________