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.

--
luigi