Hudzilla.org - the homepage of Paul Hudson
Contents > Alternative PHP uses Wish List | Report Bug | About Me ]

21.5     Making your own language

This is NOT the latest copy of this book; click here for the latest version.

The very first release of PHP was actually little more than a collection of Perl scripts, and, although it was fairly limited by not being a full-blown language in its own right, it was powerful enough to gain quite a following. Things have come full circle now, as PHP is able to be a host to your own mini-language, and this is what we'll be looking at here.

If you've any experience with the back end of PHP, you should be aware that it is made up of four parts: lexical analyser, parser, the Zend Engine, and PHP itself. Of these four, the first two are very closely interrelated and are not noticeable from a user perspective, but they form the key to the whole system. The Zend Engine can be thought of as the executor of the code and also the manager of the system, and the PHP core itself is where all the functions lie. To write our own language, we need to have everything but our own version of the Zend Engine, and this is no easy task: a fair amount of theory is involved, although I have done my best to simplify the system for the sake of learning, and you should really not be attempting this example unless you have a fairly complete grasp of the other topics that have been covered.





<< 21.4.9 Games conclusion   21.5.1 Why make your own language? >>
Table of Contents
Want to see this stuff in print? PHP in a Nutshell takes the core topics covered here, adds in thousands of edits from the editorial team and myself, and combines them to make an unbeatable reference for PHP programmers at all levels.



My latest book has hundreds more tips on how to use PHP, Apache, and MySQL, plus Perl, Python, shell scripts, performance tuning, and more!



Top-right shadow
 
Bottom-left shadow Bottom shadow

Comments from other readers
Be the first to add a comment to this chapter!



Add comment
Please note that by posting a comment here you are committing it to the public domain. This is important so that others can make use of your code themselves, and also so that I can incorporate helpful notes directly into the main text. Comments are limited to 2000 characters in length.

If you are reporting an error in the content, please tell me directly.

Your name/email address:
Your comment:
 
Now, in order to verify that you're a real person, please answer this simple question: what is one plus two?
The answer is:
(please write in
numbers, eg 19)


Top-right shadow
 
Bottom-left shadow Bottom shadow