PHP grammar?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pavenovak
Forum Newbie
Posts: 5
Joined: Fri Jan 31, 2003 10:16 am

PHP grammar?

Post 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
User avatar
skehoe
Forum Commoner
Posts: 59
Joined: Sun Dec 22, 2002 5:57 am
Location: Denver

Post by skehoe »

pavenovak
Forum Newbie
Posts: 5
Joined: Fri Jan 31, 2003 10:16 am

Post 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...
evilcoder
Forum Contributor
Posts: 345
Joined: Tue Dec 17, 2002 5:37 am
Location: Sydney, Australia

Post by evilcoder »

what exactly are you after, i might be able to help. I'm not sure what you mean by PHP grammer?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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 ;)
pavenovak
Forum Newbie
Posts: 5
Joined: Fri Jan 31, 2003 10:16 am

Bison parser - great tip!

Post 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.
User avatar
BDKR
DevNet Resident
Posts: 1207
Joined: Sat Jun 08, 2002 1:24 pm
Location: Florida
Contact:

Post 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
Post Reply