user906849
user906849

Reputation:

Change PHP grammar

I am wondering if there is a way to change out the grammar of PHP with my own.

For example:

I have read a little about ANTLR but that looks pretty complicated. Wondering if there is a simple way, like a language file?

Upvotes: 0

Views: 136

Answers (1)

georg
georg

Reputation: 215009

No, there's no simple way. Php keywords are hardcoded in the interpreter and there are no means to change them. So, if you don't like them for some reason, you options are basically:

  • edit the lexer file and compile your very own php binary
  • use a preprocessor that would convert your keywords into valid php on the fly (like http://code.metala.org/p/ccpp/, but it looks rather dead to me)
  • use a "better-than-php" language, like Hack
  • learn some other programming language
  • create your own

or

  • just deal with it. Seriously, php is only fun if you enjoy it as is and don't try to make a "better" language out of it.

Upvotes: 3

Related Questions