Page 1 of 1

PHP grammar?

Posted: Fri Jan 31, 2003 10:16 am
by pavenovak
Hi,
is somewhere PHP grammar specification available?
Something like the example below (this is from C# specs).

Thanks,
Pavel.

---------------------------------------
literal:
boolean-literal
integer-literal
real-literal
character-literal
string-literal
null-literal

boolean-literal:
true
false
integer-literal:
decimal-integer-literal
hexadecimal-integer-literal

decimal-integer-literal:
decimal-digits integer-type-suffixopt

decimal-digits:
decimal-digit
decimal-digits decimal-digit

decimal-digit: one of
0 1 2 3 4 5 6 7 8 9

Posted: Fri Jan 31, 2003 3:42 pm
by skehoe

Posted: Fri Jan 31, 2003 5:12 pm
by pavenovak
And are you sure that I can find it there? I know that there is a documentation for PHP but it's written like a story and I cannot see some formal specification...

Posted: Fri Jan 31, 2003 5:35 pm
by evilcoder
what exactly are you after, i might be able to help. I'm not sure what you mean by PHP grammer?

Posted: Fri Jan 31, 2003 7:52 pm
by volka
never found a bnf or similar for php, but zend uses a bison/yacc scanner to parse scripts. If you're really enthusiastic you might take a look at it ;)

Bison parser - great tip!

Posted: Mon Feb 24, 2003 10:08 am
by pavenovak
OK, thanks. In PHP source in files Zend/zend_language_parser.y and Zend/zend_language_scanner.l is exactly that I need.
Pavel.

Posted: Mon Feb 24, 2003 10:23 am
by BDKR
HI Pavel,

Can I ask why you're interested in the parser stuff. I've taken a look or three at the stuff and it's tough to chew on. Anyways, I was interested in messing around with the engine a bit and
that seemed like the place to start.

Cheers,
BDKR