Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 10 of 10

Thread: algorithm to c code

  1. #1
    Member
    Join Date
    Mar 2013
    Posts
    37
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default algorithm to c code

    I want to convert algorithm to c code.I have given a template for writing algorithm,according to which i will match the algorithmic statements and translate it to corresponding c code.Like if its "read a b" i will convert it to scanf() statement.Please give me some idea as how to achieve this.


  2. #2
    Member angstrem's Avatar
    Join Date
    Mar 2013
    Location
    Ukraine
    Posts
    200
    My Mood
    Happy
    Thanks
    9
    Thanked 31 Times in 29 Posts

    Default Re: algorithm to c code

    You want a program, which parses *.java file and outputs file with c code? Am I right?

  3. #3
    Member
    Join Date
    Mar 2013
    Posts
    37
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: algorithm to c code

    No.i want a program to parse input algorithm to c code.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: algorithm to c code

    Sounds like you want to write a kind of compiler where the source is the "algorithm" statements and the output is c source code.
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Member
    Join Date
    Mar 2013
    Posts
    37
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: algorithm to c code

    yeah rite
    It would be helpful if you can give some idea regarding this in early.

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: algorithm to c code

    You need to define the "source" language and what the "compiler" will generate from it.
    If you don't understand my answer, don't ignore it, ask a question.

  7. #7
    Member
    Join Date
    Mar 2013
    Posts
    37
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: algorithm to c code

    Sorry I din get you.Can you explain me pls?

  8. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: algorithm to c code

    You need to define all the possible combinations of input and what will be written out for each input.
    If you don't understand my answer, don't ignore it, ask a question.

  9. The Following User Says Thank You to Norm For This Useful Post:

    shenaz (March 17th, 2013)

  10. #9
    Member
    Join Date
    Mar 2013
    Posts
    37
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: algorithm to c code

    How can we define for all possible inputs??like we have designed a template in accordance to which input should be given.I am matching the input patterns and generating its corresponding c statement.If my idea in doing this is wrong,Pls help me out in early.

  11. #10
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: algorithm to c code

    What I meant was that compilers have a definition of the syntax of the statements of its input that must define all possible programs that it will read. Your "compiler" will need to do the same.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. XOR encryption algorithm code clean-up
    By aesguitar in forum Java Theory & Questions
    Replies: 2
    Last Post: August 2nd, 2012, 07:21 PM
  2. java code for chameleon clustering algorithm
    By draksha in forum Java Theory & Questions
    Replies: 2
    Last Post: August 11th, 2011, 07:55 AM
  3. Java code for Leader's algorithm
    By raj_k in forum Member Introductions
    Replies: 1
    Last Post: August 9th, 2011, 06:20 AM
  4. [SOLVED] Algorithm Help
    By aussiemcgr in forum Java Theory & Questions
    Replies: 2
    Last Post: September 10th, 2010, 04:12 PM
  5. algorithm
    By AmmrO in forum Algorithms & Recursion
    Replies: 13
    Last Post: September 24th, 2009, 09:18 PM