从C源代码到Java源代码的编译器(只是一部分) [英] To make compiler from C Source Code to Java Source Code (Just some part )

查看:86
本文介绍了从C源代码到Java源代码的编译器(只是一部分)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,会员



我有一些问题要问你:

如何在C中构建编译器以转换为Java?



程序的条件是



1.将您的C源代码输入编译器

2.转换并显示所有字符以及哪种类型,例如



保留字,令牌是......



3.输出以Java代码显示



顺便说一下,我在谷歌搜索相关文章他们' 说它可能但不是完整的选择,我真的知道你的意见如何证明它的一部分工作?



请给我一个建议



电子邮件<已删除>

如果您有一些C源代码转换为Java代码



谢谢。

Dear, Member

I have some question to asking you:
How to build a compiler in C to converting to Java?

The condition of program is

1.input your C source code into Compiler
2.Converting and to show all of character appears along with which type, such as

Reserve Word, Token is ...

3. Output be show in Java code

By the way I''ve searching the related article in Google they'' say it possible but not full option , I really to know your opinions How it can prove some part it working ?

Please, give me an advice

Email <Removed>
If you have some C source code to converting to Java Code

Thanks.

推荐答案

这很难,因为与Java相比,C的级别要低得多。我认为这样的工作没有任何意义。有些产品可用于将用不同语言编写的代码编译到Java机器上。我用过阿达;但它也可能是C#,面向对象的Pascal,Python,PHP等方言。请参阅:

http://en.wikipedia.org/wiki/Java_virtual_machine#JVM_languages [ ^ ]。



在此列表中添加C几乎无法做好事。适合JVM的语言通常是面向对象的,或具有紧密的功能。您需要一些东西来表示类,类的成员和相关的封装。这不是关于C.



转换为Java代码一词听起来很荒谬。那可能是什么意思?听取一个很好的友好建议:忘记它。



-SA
This is pretty difficult because C is of much lower level compared to Java. I don''t think such work would make any sense. There are products which can be used to compile code written in different languages to Java machine. I used Ada; but it could also be C#, Object-oriented dialect of Pascal, Python, PHP, and more. Please see:
http://en.wikipedia.org/wiki/Java_virtual_machine#JVM_languages[^].

Adding C to this list can hardly do something good. The languages good to target JVM are usually object-oriented, or have close capabilities. You need something to represent classes, members of classes and related encapsulation. This is not about C.

And the term "converting to Java code" sound just ridiculous. What could you possibly mean by that? Listen for a good friendly advice: just forget it.

—SA


它可能是工作,但它绝对是不平凡的。



ROOT / CINT [ ^ ]会给你关于制作这样的东西需要什么才能真正起作用的一些想法 - 但是我想使用JNI与CINT接口会更有意义。



Best问候

Espen Harlinn
It could be made to work, but it''s definitely nontrivial.

ROOT/CINT[^] will give you some idea about what''s required to make something like this really work - but then I guess it will make more sense just to interface with CINT using JNI.

Best regards
Espen Harlinn


这篇关于从C源代码到Java源代码的编译器(只是一部分)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆