![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: May 2006
Posts: 21
Rep Power: 0
![]() |
Create an Interpreter
I'm sorry if this is the wrong forum, but I wanted to know how much programming experience it would take to make an interpreter for a new programming language. I'm new to programming, so there's a very small chance that I'll be making one any time soon, but I just wanted to know how much work is involved because I'm planning on creating a new programming language in the future.
|
|
|
|
|
|
#2 | |
|
Professional Programmer
|
A lot of work is involved. Just stop thinking about interpreters right now. Chances are you won't understand what information is given to you about an interpreter if you've just started programming recently.
__________________
▄▄▄▄ Quote:
Due to incorrect calculations during the middle ages, our calendar actually begins a few years after Jesus' birth. Thus the real 6/6/6 happened a few years back. The world already ended and you missed it. Download Code::Blocks now! ▄▄▄▄ |
|
|
|
|
|
|
#3 |
|
Programmer
Join Date: May 2006
Location: Bathroom
Posts: 43
Rep Power: 0
![]() |
First get focus on assemly language and revers engineer, that will be your first step.
Here is a great book about that just click on the link below and serch for assemby languge. like jayme said forget about new languages and interpreters for now. |
|
|
|
|
|
#4 |
|
Expert Programmer
Join Date: Jun 2005
Posts: 893
Rep Power: 4
![]() |
Making an interpreter is an excellent excercise in learning to program, it gives you a better insight into what the compiler you are using is doing in the background.
It can be a large project, but like any programming project, it can be broken down into smaller parts and tackled in pieces. e.g. write a scanner first to read the input into tokens, then write the parser to take the tokens and work out what to do with them. You don't need to know assembler to write an interpreter, as the interpreter's output will end up being calls to functions in your program that perform some actions, rather than machine code. |
|
|
|
|
|
#5 |
|
Programmer
Join Date: May 2006
Posts: 85
Rep Power: 3
![]() |
Ok the first step to creating a interperator would be to completely learn a language to the fullest extent that you can manage. Then when you are good in that language start thinking about your interperator... Don't start right off by trying to make a interperator your thinking way into the future.
__________________
Code Forums |
|
|
|
|
|
#6 |
|
Sexy Programmer
|
It will take years of programming skill and experience to really develop a "WELL-DESIGNED" interpreter.
__________________
I would love to change the world, but they won't give me the source code! |
|
|
|
|
|
#7 |
|
Programmer
Join Date: May 2006
Posts: 85
Rep Power: 3
![]() |
Yes it will. I suggest learning a language to the best extent that you can first.
__________________
Code Forums |
|
|
|
|
|
#8 |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
Scheme-like interpreters are fairly simple to make.
|
|
|
|
|
|
#9 |
|
Programmer
Join Date: May 2006
Posts: 85
Rep Power: 3
![]() |
It is still an interpreter and that requires some sort of knowledge of the language, I would say a fairly good amount of knowledge to do it.
__________________
Code Forums |
|
|
|
|
|
#10 | |
|
SEXY SHOELESS GOD OF WAR!
![]() Join Date: Jun 2005
Location: Wet west coast of Canada
Posts: 1,193
Rep Power: 5
![]() |
Quote:
If you actually want a bona-fide programming language, especially one with syntax/error checking of any kind, it can be a huge task. It's much more manageable if you instead are thinking of a simple script language with limited keywords and operands. By sticking to only a few very strict operation/operand formats, you could reduce the complexity immensely. It would then be relatively trivial to 'compile' the code to a form of bytecode, but of course you'd need to invent this bytecode. It could be a very simple format with each instruction being a fixed size, with a few components such as operation, first operand, and second operand. Obviously, some of these fields would be unused for certain instructions, but could be left blank to keep the format consistent, unless space was at an extreme premium. You could have direct bytecode equivalents for all basic instructions (like arithmetic and moving from one variable to another), while more complex commands (displaying a messagebox with text, for example) would be handled by passing parameters to a function built into your interpreter. As I see it, the hardest thing in this system would be handling memory allocation for (usually) dynamically-sized objects like strings, but even this could be worked around (allocating the memory during the 'compile to bytecode' stage, and not the 'interpret bytecode' stage).
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot. - Vaarsuvius, Order of the Stick |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|