Implementing a new language (1)

Source: Internet
Author: User

Background

Two months ago self-taught the principle of compiling, in a cursory study of the front end of the implementation of a language can not be counted, has always wanted to maintain it, but the source code is written in Java, in my current state of Java completely can not interest, this period of time to learn C + +, Almost no high point was found after the regular expression was implemented, so it was decided to re-implement a language in C + +. In order to increase the difficulty I am ready to implement an object-oriented language, but also to reduce the difficulty I decided to temporarily do not write the language of the CFG (in fact, I do not quite remember how to write context-independent grammar), until the implementation process, how simple to write ... Because my actual level is limited, the compilation principle study is also very limited, may many places the realization way will follow own idea rather than the standard, if everybody interest welcome and I exchange ...

Implementation plan

In order to achieve the effect of C + +, and in order to prolong the development cycle, do not let themselves into the world to find practiced hand project dilemma, the development process I will follow the principle:

  1. All the data structures used, the algorithms are done in freehand manner, in other words, you may not see the containers and algorithms in the standard library.
  2. Because my current knowledge of the previous paragraph is very limited, and I do not intend to take the time to study, the flow flex bison , so it is possible that lexical analysis and grammar analysis will be hand-coded way, so it is hand-made.
  3. So you can see I this project for the standard library dependence is relatively low, but also want to improve their own coding level, so there may be halfway to build the wheel chapter, hope Understanding.
  4. The last point is also the most important point, I really just a C + + beginner, I contact C + + only one months, and I touch programming just a year, so whether in the language or in the implementation of the algorithm if there are any problems can be casually pointed out, I very much hope to get other people's valuable advice.

The actual code should start from the next section, today a cursory look at the previous blog, because they have not attached importance to typesetting, only to find that the previous article typesetting like excrement, they can not see, and will strive to improve in the future ...

?

Implementing a new language (1)

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.