The Artima Developer Community
Sponsored Link

Java Answers Forum
please help...

1 reply on 1 page. Most recent reply: Jul 7, 2005 6:52 PM by Antonio

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
sally

Posts: 1
Nickname: ylla
Registered: Jul, 2004

please help... Posted: Jul 26, 2004 7:51 AM
Reply to this message Reply
Advertisement
1. what are EBNF grammars and how are they used in describing programming language syntax?


2. how to convert a Java program into an equivalent C program?


3. how to convert Javaclasses with attributes and methods to C'sstruct's and functions.


4. how to convert method overloading inJava into C functions.


5. how to convert method overriding in Javainto Cfunctions.



please help...
thank you.


Antonio

Posts: 33
Nickname: arhak
Registered: Jul, 2005

Re: please help... Posted: Jul 7, 2005 6:52 PM
Reply to this message Reply
It is not a simple question.

1) an EBNF grammar is a formalization of a language specification for example a Java class may be something like this:
java_class ::= package_decl imports visibility_modifiers 'KW_CLASS' identifier extends_decl implements_decl class_body
where the lowercase words are non-terminals and upercase words are terminals.
'KW_CLASS' is nothing else than the word "class"
while visibility_modifiers is something like:
visibility_modifiers ::= 'KW_PUBLIC' | 'KW_PROTECTED' | empty | 'KW_PRIVATE'

Another formalism is the BNF grammars (the example is both BNF & EBNF, because the first is subset of the second one) and they are usefull in compilers construction because there are several tool for making lexical analizers and/or syntactical analizers beginning with a BNF or EBNF grammar.

2) It won't be easy to parse any kind of Java program, it is a huge grammar (maybe a Java subset). You will need to do a lexical analizer and a syntactical analizer to recognize the Java sources and will have to think a lot to achieve the convertion to C

3) 4) 5) This is much more complex than point 2), you don't wake up one day and say "I'm going to make a migration tool", you will have to study a lot. Start looking for "Compiler Techniques and Tools" book and keep looking for more books about it.

Good look

Flat View: This topic has 1 reply on 1 page
Topic: How can I get a Companent's content and show it in another new Companent? Previous Topic   Next Topic Topic: translator in Java...

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use