[TYPO3-50-general] TypoScript 2.0 EBNF

Robert Lemke robert at typo3.org
Tue Jun 12 08:53:54 CEST 2007


Hi Elmar,

Am 11.06.2007 um 23:39 schrieb Elmar Hinz:

> 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.

Yes, you're right. However, I decided to not program a lexer because  
after
starting with it I realized it would only complicate things if we worked
with tokens and even tokenize ourselves. Instead of writing my own  
FSM [1]
I just used regular expressions.

Although I'm not really an expert in compilter theory, I think that  
this is
just a valid way to go.

> 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".

You're absolutely right, parse conditions are the weak point. The big  
requirement
for implementing them is that the condition must be evaluable during  
parse time.
Therefore most of the traditional conditions like browser agent, ip  
address etc.
wouldn't work.

Therefore I called them "parse conditions" so it becomes clear that  
these are
conditions for parsing and only at parse time. One condition I  
imagine for that
is the TYPO3 Environment: If in development mode, use this  
TypoScript, if in
production mode, use that.

Most of the other conditions (time, browser agent etc.) will have to  
be implemented
with .if conditions. But at least we have simplified the syntax of that.

Cheers,
robert


[1] http://en.wikipedia.org/wiki/Finite_state_machine

robert
-- 
http://typo3.org/gimmefive




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