Click here to Skip to main content
16,020,669 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,

Just a general question:

A made-up programming language that is then interpreted/compiled(?) using a high-level programming language such as C++ to give output is what: a compiler or an interpreter

E.g.

MoveCursor(132, 242 (Spline))
- made up programming language example.

This would then be interpreted/compiled(?) to move the cursor to a certain position with a high-level language. The high level language would take care of the spline algorithm, the timer functions, etc.

My question is: Is this made up language a source-to-source compiler, or is it an interpreter?

Thanks for your help.

What I have tried:

Reading up on compilers and interpreters; however, if this is to be my ultimate project, I need to know for absolute sure what it is that I'm actually doing.
Posted
Updated 7-Jan-18 9:44am

1 solution

Quote:
My question is: Is this made up language a source-to-source compiler, or is it an interpreter?
Neither. It's a programming language.

A compiler is a program that transforms code from one language to another (for example, C to Assembler). An interpreter is a program that performs instructions written in a programming language (without requiring compilation). You don't have any of these yet for your language: at best, all you have is a language specification.

After creating a full language specification (rather than just one command), it's still up to you whether you create an interpreter or compiler (and another developer could always decide to create the other one, starting from your language specification). A language doesn't have the property "interpreted" or "compiled", but your implementation does.
 
Share this answer
 
Comments
[no name] 7-Jan-18 16:46pm    
Thanks very much for your reply.

What if my made-up language were to do this:

"BeepAfter(1000)" - beep after a second.

If I were to try to program a compiler/interpreter in a high-level language to create and start a timer component to beep after 1000ms, what would I have created? Would that be a source-to-source compiler or an interpreter?

Thanks for the explanation!
Thomas Daniels 7-Jan-18 16:48pm    
Well... that's impossible to tell based on that description. You could do that with both a compiler and an interpreter - refer to the definitions I gave in my answer. If they are not enough, the corresponding Wikipedia pages provide more elaborate definitions.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900