Making your own language

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.

 

Next chapter: Why make your own language? >>

Previous chapter: Games conclusion

Jump to:

 

Home: Table of Contents

Follow us on Identi.ca or Twitter

Username:   Password:
Create Account | About TuxRadar