Create an executable for a program in an interpreted language: Difference between revisions

Tried to clarrify the task...
(Added Wren)
(Tried to clarrify the task...)
Line 2:
Languages can be implemented by interpreters or compilers. Some languages are implemented by both techniques.
<br><br>
If a language is implemented via a compiler, the developer (usually) writes one or more source files in the language, submits them to the compiler and (all being well) receives a compiled executable in return. That executable only does what the specific program does.
It can be convenient to provide an executable even when the language is normally interpreted. The purpose of this task is to show how it could be done for your language.
<br><br>
One method of doing this would be to create a program in a language for which there is a compiler available (C for example) that writes the actual interpreted source to a temporary file, calls the interpreter to run it and then deletes the temporary file afterwards.
<br>
If the language is implemented via an interpreter, the decveloper (usually) writes one or more source files and invokes an interpreter to execute the program. Generally "object code" as such, is not created.
<br><br>
Suppose we want to have it both ways and we want to "compile" the interpreted code and get an executable that will only do what the specific interpreted program does i.e.., not a general interpreter.
<br><br>
ItSo, caninstead beof convenientsupplying tothe providesource anfor executablethe evenprogram, whenwe thejust want to produce an executable languagefor isthat normallyspecific interpretedprogram. The purpose of this task is to show how it could be done for your language.
<br><br>
One method of doing this would be to create a program in a language for which there is a compiler available (C for example) that writescontanss the actualsource of the program to be interpreted, sourcewrites it to a temporary file, and calls the interpreter to run it and then deletes the temporary file afterwards.
<br><br>
Alternatively, if the interpreter provides itself as an API and allows the source to be specified by other means - as a string perhaps, the need to write a temporary file would be avoided.
<br><br>
For example, let's assume we need an executable that will run the Hello World program in the interpreter only language I. The I source might be:
<pre>
3,038

edits