Tools for translating scheme into Java and C + +

Source: Internet
Author: User

First, why write this tool?

The company content has multiple projects need the same function, and these projects, some in Java, some in C + +, and because of some real-world constraints, not all projects can invoke a unified service interface (such as: May run in the case of No network), so there are two options:

A. Two sets of functions are implemented in Java and C + + respectively.

B. Implement a build tool to generate Java and C + + code for the same logic.

......

Second, the content of this article will not

I don't want to involve any business in a technical article, and to avoid leaks of any kind of company-sensitive information, the key code in this tool will not appear in this article, namely:

A. The code in this article is used to describe the easy-to-write test code without the actual project code.

B. This article is about technology only and does not involve business processing.

Third, why use scheme to do as the source language?

The first thing to say is that the source language is a scheme-like language, not a scheme itself, but the syntax is very similar.

So why use scheme in the form of the source language? Do you just need to translate Java into C + + in Java?

The reason I choose to use scheme is:

A. This language is a dynamic type language, so the type of the object is not syntactically present in the declaration.

B.scheme-like is actually lisp-like (s-expression), which is a very simple syntax, and is highly unified on various language elements and is very easy to implement.

Based on the above two points, later if we write a graphical tool (for business users directly use to edit the algorithm) to generate the language is also relatively easy-if you want to write a GUI tool to edit the good algorithm, generated directly Java code, it is a bit too difficult, although still can do, But the workload may be 10 times times or even dozens of times times the gap. Therefore, for the future possible processing convenience, and now the implementation of the language itself is convenient, here to choose a language "seemingly" no type, and the syntax of simple syntax to do is better. At the same time, because the language is all I am doing, it will not be difficult to add more expressive grammar to the current grammar.

Iv. about types

V. Expressions and Functions

Vi. about delay calculation

Vii. about Short Circuit

......

Today is a little tired, another day to finish it.

Tools for translating scheme into Java and C + +

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.