[TYPO3-50-general] TypoScript 2.0 EBNF

Elmar Hinz elmar.DOT.hinz at team.MINUS.red.DOT.net
Mon Jun 11 23:39:58 CEST 2007

Am Tue, 29 May 2007 19:28:18 +0200 schrieb Robert Lemke:

> Hi folks,
> this morning I wrote a lengthy mail in response to the TS 2.0 thread,  
> but it somehow disappeared. I'll write it again but it could be that  
> it's tomorrow until I find the motivation to write everything again ...
> Anyway, today I spent more thoughts about the TS 2.0 syntax and  
> parsing. I though that it would be a good idea to write down the  
> syntax definition of TypoScript, which should make it much easier to  
> write the actual lexer / parser. Although I have no experience with  
> that, I tried to write down the definition in the EBNF notation. If  
> anyone of you knows that better or finds errors in my definition,  
> please let me know.
> So here is my draft, up for discussion an improvement:

Hi Robert,

a few weeks ago I did a study and wrote a basical TS lexer and compiler,
which you can find in TER with the extension key "tsc". There are a lot of
similarities even similar namings. So I can say, that your draft would work
by principle.

Within the lexer I use modes. In "value" modes whitespace is maintained, in
other modes whitespace is simply thrown away. EBNF typically is used as
compiler specification. Because you can drop whitespace already in the
lexer you don't need it in EBNF, wich simplifies matters.

The most critical point in your draft are the ParseConditions for me. If I
imagine them as TS1 like CONDITIONS, they work as a kind of blocks. You
certainly can put them into an EBNF draft. In praxis I would implement TS1
like conditions as a preprocessor, so that they have their work done,
before the lexer and compiler are even reached. That's one reason why I
wouldn't put them into EBNF.

I don't like TS1 conditions at all. I think it's difficult or even
impossible to implement them on object level or to represent them for
example in an XML export of the TS configuration. I suggest to drop them
from TS2 and replace them with conditions build into objects. Maybe you
have something else in mind when writing "ParseConditions".



More information about the TYPO3-project-5_0-general mailing list