[TYPO3-50-general] TypoScript 2.0 EBNF

Robert Lemke robert at typo3.org
Tue Jun 12 10:40:45 CEST 2007

Hi Christian,

Am 12.06.2007 um 09:24 schrieb Christian Welzel:

> I do not think, that it complicates things. It even simplifies them.
> There are three big advanteges for using a lexer in a compiler
> (additionally to the better readability agains regexps):
> 1) you can implement the ebnf really straight forward if you
>    have not to hassle with pattern matching in the parser.
> 2) a lexer+parser combo is faster than regexps.
> 3) things like
> blabla./*comment.*/value=foo
> blabla.value = "text 'text'"
> blabla.value ='small \'text'
>    are handled by the lexer. you dont have to deal with it in the
>    parser.

I'm sure you're right with the scanner part - it will remove  
comments, empty lines etc.
But I played a little with tokenizing the TypoScript and very soon  
got the impression
that I'd have to produce a lot more code than with only regex.

If you like, please have a look at my current implementation [1]. The  
parser consists
of about 400 lines of code at the moment and for me it still looks  
quite intuitive,
especially when you see the EBNF defintion side by side with the code.

I suggest that I implement the remaining features and then I'd ask  
you to review the
code and make improvements. Because we have the unit tests in place,  
you can experiment
with speed- and other improvements without breaking things. How about  


[1] http://5-0.dev.typo3.org/trac/TYPO3/browser/Packages/TypoScript/ 

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