Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I create a language like PHP and how does it work? [closed]

I want to know how to create a language like PHP. How does the server know how to translate a PHP file? How does it work? I want to do this for educational purposes. A simple language with basic features like echo, etc.

like image 365
liamzebedee Avatar asked Nov 24 '10 09:11

liamzebedee


People also ask

What is PHP how it works?

PHP is a server side scripting language that is embedded in HTML. It is used to manage dynamic content, databases, session tracking, even build entire e-commerce sites. It is integrated with a number of popular databases, including MySQL, PostgreSQL, Oracle, Sybase, Informix, and Microsoft SQL Server.

Is PHP its own language?

PHP is an open-source server-side scripting language that many devs use for web development. It is also a general-purpose language that you can use to make lots of projects, including Graphical User Interfaces (GUIs).

What language is PHP made in?

PHP as it's known today is actually the successor to a product named PHP/FI. Created in 1994 by Rasmus Lerdorf, the very first incarnation of PHP was a simple set of Common Gateway Interface (CGI) binaries written in the C programming language.

Can I create my own programming language?

You can just take a subset of an existing language or come up with a simple variation of it and get started. However, if you have plans for creating your very own programming language, you will have to give it some thought. I think of designing a programming language as divided two phases: The big-picture phase.


1 Answers

In basics, when webserver get's request to process php file it translating this request to php processor, it could be a module (like php.so in apache) or service (like php-cgi). Service or module compiles php script to machine code, executes it and gives the server the result of his job. You can download php source code from http://php.net. Source code include parser, thanslator, compiler and other components needed to execute php script as machine code

like image 68
Vadyus Avatar answered Sep 25 '22 19:09

Vadyus