Previous in Forum: 256MB Ram   Next in Forum: ADSL Router
Close
Close
Close
9 comments
Rate Comments: Nested
Participant

Join Date: Oct 2012
Posts: 1

C++ Interpreter

10/05/2012 6:46 AM

Please can some body knows how to write a C++ interpreter that reads any programs??

for example reading wombat 1 computer

Register to Reply
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.

"Almost" Good Answers:

Check out these comments that don't yet have enough votes to be "official" good answers and, if you agree with them, vote them!
Guru
United Kingdom - Member - Indeterminate Engineering Fields - Control Engineering - New Member

Join Date: Jan 2007
Location: In the bothy, 7 chains down the line from Dodman's Lane level crossing, in the nation formerly known as Great Britain. Kettle's on.
Posts: 32175
Good Answers: 839
#1

Re: C++ interpreter

10/05/2012 7:00 AM
__________________
"Did you get my e-mail?" - "The biggest problem in communication is the illusion that it has taken place" - George Bernard Shaw, 1856
Register to Reply
Commentator

Join Date: Aug 2012
Posts: 68
#2

Re: C++ Interpreter

10/06/2012 3:24 AM

C++ programs are written in difference kinds of C++ compilers so you can do that but you can modify an C++ source code to a source code of your compiler that you work.

Register to Reply
Participant

Join Date: Sep 2010
Location: Klerksdorp, North West Province, South Africa.
Posts: 3
#3

Re: C++ Interpreter

10/06/2012 3:54 AM

Hi, I am not an expert with C++ but have found the program from "Bloodshed" to work the best as an all rounder.

Their domain to download the DEV-C++ program is http://www.bloodshed.net/ and it is free of charge.

They also do other applications such as Pascal DEV-PAS and other very useful utilities.

I hope this helps.

Keep Well,

Adrian.

Register to Reply
Guru

Join Date: Feb 2012
Posts: 595
#4

Re: C++ Interpreter

10/06/2012 7:51 AM

http://www.cplusplus.com/forum/general/11820/ (by: http://www.google.com/search?q=C%2B%2B+interpreter+&sourceid=ie7&rls=com.microsoft:en-US&ie=utf8&oe=utf8)

as far as i get the interpreter is smth. you run from some env. to get responce to some syntax - why dont you write CMD.EXE batch extentions c_print.bat myVar1 myVar2 that executes whatsoever_print.exe myVar1 myVar2

what's your question?

__________________
ci139
Register to Reply Score 1 for Good Answer
Guru

Join Date: Feb 2012
Posts: 595
#8
In reply to #4

Re: C++ Interpreter

10/08/2012 3:27 AM

or to be less fuzzy::

/* as for MS-DOS */
C:\CppNTRPRT.EXE "int main(void){return 0;}"
C:\CppNTRPRT.EXE unCompiledCppSrcCde1.c unCompiledCppSrcCde2.c
/*where CppNTRPRT.EXE is C++ interpreter */

how to wite the C++ interpreter ? = how to write a compiler ?

<- this is HARWARE SPECIFFIC = you don't know the hardware from beginning to the end = U'r F'd

__________________
ci139
Register to Reply Score 1 for Good Answer
Guru
Popular Science - Weaponology - New Member Safety - ESD - New Member Hobbies - Fishing - New Member

Join Date: Sep 2006
Location: Near Frankfurt am Main, Germany. 50.390866N, 8.884827E
Posts: 17996
Good Answers: 200
#5

Re: C++ Interpreter

10/06/2012 8:52 AM

If you don't get anywhere with the suggestions already made, you could do what I did many years ago, I wrote a simple GWBASIC program to convert the text of one compiler program into the text of the compiler I had. It was surprisingly easy.......

Nowadays a more modern BASIC would be better, but as you are only converting text to text, its not rocket science. Even an old copy of GWBASIC, which is public domain and very easy to use, would still do the job. On a modern PC, it will run surprisingly fast, though I only ever used it upto and including XP.

Once you have ironed out the bugs, it will run fast and accurately for you.....

__________________
"What others say about you reveals more about them, than it does you." Anon.
Register to Reply
Guru

Join Date: Oct 2009
Posts: 1460
Good Answers: 30
#6

Re: C++ Interpreter

10/06/2012 9:05 AM

Your question is not entirely clear. Does "reading wombat 1 computer" mean recovering the source code of a wombat 1 program? If so the correct word is "decompile". Decompilers exist for several situations, but they are machine-specific: you are not going to find a decompiler which works on all possible CPU architectures.
If you mean that you want to use a C++ interpreter (which is a pretty scarce beast, because almost everyone prefers a compiler) to generate wombat 1 programs, this would be like using a bus to go next door. It is far too complicated for a very simple job.
If you want to decompile a wombat 1 program, it consists of a series of 16-bit numbers, with the op code occupying the first 4 bits and the address field in the remaining bits. the exercise is basically identifying the op code and writing out the appropriate mnemonic text, then doing the same for the address field, which may be the accumulator or a data address. Compiled programs do not store the original label names, so you will have to use names like Label1, Label2 etc for the labels to jump to. Equally, the original comments are not stored either. That would not be a difficult task in C++.

Register to Reply
Guru
Popular Science - Weaponology - New Member Safety - ESD - New Member Hobbies - Fishing - New Member

Join Date: Sep 2006
Location: Near Frankfurt am Main, Germany. 50.390866N, 8.884827E
Posts: 17996
Good Answers: 200
#7
In reply to #6

Re: C++ Interpreter

10/06/2012 9:31 AM

You are completely right, it is not clear exactly what he wants to do......thanks for your observations.....

__________________
"What others say about you reveals more about them, than it does you." Anon.
Register to Reply
Anonymous Poster #1
#9

Re: C++ Interpreter

02/20/2013 4:28 AM

hello,

In my opinion writing code of c++ interpreter requires a thorough knowledge automata and theory of communication their are various interpreter which are working in this field, you must have thorough knowledge of it, for further information you can go here:

http://blog.oureducation.in/questions-on-principle-of-programming-language/

Register to Reply
Register to Reply 9 comments

"Almost" Good Answers:

Check out these comments that don't yet have enough votes to be "official" good answers and, if you agree with them, vote them!
Copy to Clipboard

Users who posted comments:

Andy Germany (2); Anonymous Poster (1); caeser (1); ci139 (2); komena (1); phph001 (1); PWSlack (1)

Previous in Forum: 256MB Ram   Next in Forum: ADSL Router

Advertisement