Can I use Python to implement the Python interpreter?

Source: Internet
Author: User
Php Chinese network (www.php.cn) provides the most comprehensive basic tutorial on programming technology, introducing HTML, CSS, Javascript, Python, Java, Ruby, C, PHP, basic knowledge of MySQL and other programming languages. At the same time, this site also provides a large number of online instances, through which you can better learn programming... Reply: Python interpreter implemented in Python, the most famous and completed Python interpreter Does not belong.
However, if you want to use Python to implement A simple Interpreter with the same idea as CPython, refer to this: A Python Interpreter Written in Python.

For more information, please jump to the portal:
  • Is there any content similar to "Python source code analysis", but the content has been updated, for the new version of Python books? -Redna xelafx
  • What is the meaning of the JavaScript interpreter written in JavaScript? -Redna xelafx
Of course, yes, but unlike the compiler, the compiler can compile itself, and the interpreter cannot explain and run itself. the interpreter at the outermost layer always needs to run with other programs. However, the interpreter at the outermost layer can only interpret a subset of the language, and the interpreter at the lower layer can use this subset to implement more and more complete functions, in this way, the interpreter of the outer C can remain unchanged. when adding new functions, you only need to upgrade the interpreter written in Python. The idea of PyPy is similar to this. Languages with complete functions make self-X easier. For example, C/C ++ compilers are all developed using C/C ++. Of course you can. for example, the famous PyPy, I think the question is, can you use a language to implement a language compiler (the same language )?
A: Not at the beginning. later, you can.
To put it simply, it is "self-raising"
Why?
Because from the machine perspective, we must use a machine that can now recognize other languages to compile a compiler for a new language.
Once the compiler is made, if you can use this binary compiler to compile a compiler written in the same language.
This is "self-raising"
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.