Compiler inside a Interpreter

Please support our Computer Science advertiser: Learn about neural networks and artificial intelligence.
Thread Solved

Join Date: Dec 2007
Posts: 13
Reputation: rigidboss has a little shameless behaviour in the past 
Solved Threads: 0
rigidboss rigidboss is offline Offline
Newbie Poster

Compiler inside a Interpreter

 
0
  #1
20 Days Ago
Hello All,

I have a doubt...

basically I worte my first interpreter in C (A very simple one though... )

I will take a input file and will pass as command line arguements to my interpreter . This file will convert the input file to standard C file and will store in .C extension.

Now how do I call a C compiler insider my function itself, so that this generated C file will be compiled and executed at once.

Eg.

I create a text file test.txr as follows

Hello PRINTA ......

Hello GETTA .....

I pass this file as a command line...

conv text.txr (In command line)

This conv.C takes this file as input and convert PRINTA as printf and GETTA as scanf etc . (As you know..... simple pre processor).

So as the end, text.C will be generated.... All was fine till here.

Now I wanna compile this text.C and execute inside this conv.C itself.

Do you get my objective...............???????????/

Is this possible??????????

Waiting for your help guys......... I;m doing it for one charity process. I want this to happen ASAP.

--Rigidboss
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 65
Reputation: kolosick.m188 is an unknown quantity at this point 
Solved Threads: 13
kolosick.m188's Avatar
kolosick.m188 kolosick.m188 is offline Offline
Junior Poster in Training
 
0
  #2
20 Days Ago
You can use the system function to run the compiler and then run the compiled code
There are 10 types of people in the world, those who get this, those who don't, and those who thought this was binary.
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 13
Reputation: rigidboss has a little shameless behaviour in the past 
Solved Threads: 0
rigidboss rigidboss is offline Offline
Newbie Poster
 
0
  #3
19 Days Ago
Originally Posted by kolosick.m188 View Post
You can use the system function to run the compiler and then run the compiled code
Hi... Thanks for posting.........

I already sorted out this issue . I used the system function.......

Thanx a lot ))))))))

Meanwhile I have a idea on creating a special language .

Namely ABSTRACT PROGRAMMING LANGUAGE (APL)

The details which we give will be abstract. The compiler inturn will process it and will create a response .

Is this possible ??????? If so how and where should i start.

Eg

In put : Let a be 10 and B be 20 .

Out put which will be fed to the compiler must be : int i=10, b=20 ;

Like this, I want to create a programming language......

Pls Help!!!!!!!!
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 65
Reputation: kolosick.m188 is an unknown quantity at this point 
Solved Threads: 13
kolosick.m188's Avatar
kolosick.m188 kolosick.m188 is offline Offline
Junior Poster in Training
 
0
  #4
19 Days Ago
Take a look at yacc and lex. Also, APL is already a programming language
There are 10 types of people in the world, those who get this, those who don't, and those who thought this was binary.
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 13
Reputation: rigidboss has a little shameless behaviour in the past 
Solved Threads: 0
rigidboss rigidboss is offline Offline
Newbie Poster
 
0
  #5
18 Days Ago
Originally Posted by kolosick.m188 View Post
Take a look at yacc and lex. Also, APL is already a programming language
Hi...

Thanks for ur help!!

I did read Lex and Yacc.

That's what I exactly did in my previous program . Anyways It gave some ideas.

Regarding APL . I just kept one name....

Anyways thanks for your help!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Computer Science Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC