f



Decompilable interpreter/compiler hybrid

I have an idea to design simple programming language that will be in
the same time compiled and interpreted. The language can consist of
expressions, functions and statements EXIT IF to conditionally leave
function, and LOOP IF to conditionally restart the function.

The idea is that :
a) Source code is same as object code (interpreter's idea). In memory
actually stands only machine object code. When displayed on screen, or
edited in editor, it will be decompiled to ASCII. Every time when the
line is entered, it will be compiled to machine code

b) However, the object code is standalone and can be run without
additional interpreters or libraries. (compiler's idea)

The language is aimed for diskless computers with very low RAM (8 bit
computers or pocket devices) where keeping source and object code in
memory is too limiting, while interpreters are too slow.

Does such kind of decompilable interpreter/compiler hybrid exist?
AFAIK, the most similar concept has language Forth, however it still
needs an interpreter.

0
7/2/2003 4:44:19 AM
comp.compilers 3310 articles. 1 followers. Post Follow

3 Replies
1018 Views

Similar Articles

[PageSpeed] 59

On Wed, Jul 02, 2003 at 12:44:19AM -0400, Samir Ribic wrote:
> I have an idea to design simple programming language that will be in
> the same time compiled and interpreted. The language can consist of
> expressions, functions and statements EXIT IF to conditionally leave
> function, and LOOP IF to conditionally restart the function.
>
> The idea is that :
> a) Source code is same as object code (interpreter's idea). In memory
> actually stands only machine object code. When displayed on screen, or
> edited in editor, it will be decompiled to ASCII. Every time when the
> line is entered, it will be compiled to machine code
>
> b) However, the object code is standalone and can be run without
> additional interpreters or libraries. (compiler's idea)
>
> The language is aimed for diskless computers with very low RAM (8 bit
> computers or pocket devices) where keeping source and object code in
> memory is too limiting, while interpreters are too slow.
>
> Does such kind of decompilable interpreter/compiler hybrid exist?
> AFAIK, the most similar concept has language Forth, however it still
> needs an interpreter.

I guess I must not understand your problem. Specifically, why is Forth an
unacceptable choice for your problem domain? Yes, Forth has an interpreter,
but the whole language is so incredibly lightweight that including all of
the baggage that a development environment brings with it (ie IDE, sample
code, documentation, and so on) could for a long time (ie as recently as
1998 or so) fit on TWO floppy disks. And THAT was an environment for doing
Mac OS development. I remember hacking around with Forth back in the early
1980s where the entire environment (interpreter, editor, dictionary, AND
operating system) could fit in 8KB of memory.

So if you are simply trying to find decompilable languages with a small
memory footprint and a combination interpreted/compiled nature, look hard
at Forth. OTOH, if you are simply looking to create such a language as a
fun personal project, again, look hard at Forth, as your language can learn
much from the Forth way of thinking.

Just my 2.36 yen, YMMV, void where prohibited by law.
--
Timothy Knox
tdk@thelbane.com
"War is Peace. Freedom is Slavery. Windows is an Operating System."
0
Timothy
7/4/2003 4:05:46 AM
"Samir Ribic" <samir.ribic@alemsistem.com.ba> wrote in message

===snipped
> The language is aimed for diskless computers with very low RAM (8 bit
> computers or pocket devices) where keeping source and object code in
> memory is too limiting, while interpreters are too slow.
>
> Does such kind of decompilable interpreter/compiler hybrid exist?
> AFAIK, the most similar concept has language Forth, however it still
> needs an interpreter.
>

You really should reinvestigate Forth, especially cross-compiled Forths.

Forth has two interpreters, an outer interpreter and an inner interpreter.
The outer interprets the source code and builds the executable (in some
forths, a series of execution tokens; in others, machine code subroutines)
that the inner interpreter executes. The inner interpreter is, in closest
analogy, a VM. Cross-compiled Forths have the outer interpreter/compiler on
the source machine; the target is just the code you wish to execute, along
with the inner-interpreter, which has an _extremely_ small footprint. Most
inner interpreters are measured in 10s to 100s of bytes.

For a commercial solution see
http://www.forth.com/Content/Products/SwiftX/SwiftX.htm, a product from
Forth inc that targets a wide range of devices; they claim to be able to
retarget to most devices in 2 to 3 weeks. Applications developed this way
are perfectly ROMable. Devices currently supported include 68Ks, ColdFire,
68HC11/12, 8051, others...

Or, if you're wanting to try your hand at developing your own based on other
work, look at pygmyForth, developed by Frank Sergeant. To quote: "A
3-instruction Forth makes Forth affordable for target systems with very
limited memory. It can be
brought up quickly on strange new hardware. It only takes 66 bytes for the
Motorola MC68HC11. Full source is provided." Worth a look at
http://www.eskimo.com/~pygmy/forth.html. And Brad Rodriguez' site
http://www.zetetics.com/bj/papers/ describes the techniques used in Forth
systems, and provides a tutorial on designing a Forth for Z80/6501/6809
chips.

Oddly, an execution token Forth can be much smaller than machine code. This
makes it ideal for small imbedded devices. It also has the advantage that
the token is translatable back (in most cases) to the original source code.
Speed need not be compromised either; optimising Forths can produce code
that is as fast as C.

--
Regards
Alex McDonald
0
Alex
7/4/2003 4:07:34 AM
On Wednesday 02 Jul 2003 5:44 am, Samir Ribic wrote:
> a) Source code is same as object code (interpreter's idea). In memory
> actually stands only machine object code. When displayed on screen, or
> edited in editor, it will be decompiled to ASCII. Every time when the
> line is entered, it will be compiled to machine code

One way to do this is to write your compiler as a logic
program in prolog or a similar language. Because of the declarative
nature of logic programming, you can feed the object code to
the compiler and recover the source code.
Implementing optimisations to such a compiler is a little tricky
(to say the least!). This paper by Jonathan Bowen
describes one example:

http://www.museophile.sbu.ac.uk/pub/jpb/jsm.pdf

You will need a tiny prolog implementation, go to
http://www.programmersheaven.com/ and search for
"tiny prolog" for an example (the ZIP file contains
a 27Kb .com executable and 49Kb PASCAL source)

--
			Martin

Martin.Ward@durham.ac.uk http://www.cse.dmu.ac.uk/~mward/ Erdos number: 4
0
Martin
7/4/2003 4:09:37 AM
Reply:

Similar Artilces:

which compiler compiled?
Is there a way I can tell which compiler compiled an executable? I looked at the file with a hex editor and didn't see anything obvious. Lawrence "Lawrence" <just4me@nowhere.com> writes: > Is there a way I can tell which compiler compiled an executable? Yes with some compilers and some executable formats. E.g. on HP-UX for PA-RISC: $ aCC leak.C $ odump -compunit a.out ... 6 0 ANSI C++ leak.C /tmp ctcom options = -inst compiletime -diags 523 -inline_power 1 -longbranch 2 -unique_strings on -cachesize 256 B...

To compile or not to compile
Is there some benefit in compiling the apache source yourself? -- //Points ------------------------------------------------------------ http://underthebed.homeip.net ...

Compiled or not compiled
I need to distinguish between two situations: one when a Matlab function is run from Matlab command window and the other one when it is run in compiled mode. Any ideas how to do this? Thanks Tomy Duby "Tomy Duby" <tomy.duby@agilent.com> wrote in message news:idq8q8$85k$1@fred.mathworks.com... > I need to distinguish between two situations: one when a Matlab function > is run from Matlab command window and the other one when it is run in > compiled mode. > Any ideas how to do this? HELP ISDEPLOYED. -- Steve Lord slord@mathworks.com comp.s...

Compile or not compile?
There's something that sometimes in while it bores me a little bit. How do I know if I need to compile a function/procedure or it will be able to compile "on fly". At the beginning I thought this was related to the paths idl "knew", but this happens for two functions/routines in the same directory. Can someone tell when a function can be runned without be compile? Nuno Oliveira wrote: > There's something that sometimes in while it bores me a little bit. How > do I know if I need to compile a function/procedure or it will be able > to compile &quo...

Compiling Compiler
Hi there, I need some advice/opinion of the experts out there regarding compilers. I have sun cc compiler that supports 64 bit environment. Now, I compile ACK using this compiler.This should give a compiler that supports 64bit environment. Since the output files are in Solaris format, I compile the ACK source *once again* using the just compiled ACK compiler so that I get Minix object and binary files. Now my questions is that does this 2nd version of ACK be able to produce true 64bit code? Sanky wrote: > Hi there, > > I need some advice/opinion of the experts out there regarding...

To compile or not to compile
Is there some benefit in compiling the apache source yourself? -- //Points ------------------------------------------------------------ http://underthebed.homeip.net ...

compiling Qt .... compiling Qt ....compiling Qt.... compiling Qt
I got myself new kernel from kernel.org... make xconfig needs Qt (new system). So I got new Qt source this afternoon. It is still compiling.... Who said MS is bloat has not done this. What does Qt do? Dunno, how about xforms for xconfig? On Thu, 02 Feb 2006 19:18:09 +0000, Jan Panteltje wrote: > Dunno, how about xforms for xconfig? Why not curses based? menuform -- Hilsen/Regards Michael Rasmussen http://keyserver.veridis.com:11371/pks/lookup?op=get&search=0xE3E80917 On a sunny day (Thu, 02 Feb 2006 21:55:33 +0100) it happened Michael Rasmussen <mir@miras.or...

r4rs interpreter or compiler should be able to compile or interpret r5rs reference code right?
r4rs interpreter or compiler should be able to compile or interpret r5rs reference code right? where is such reference code? any one is keeping track how this can be done? (like "linux from scratch") where is the process documented? where is r5rs scheme compiler that can compile to c code? is my work going to be tied with particular VM implementation? On Mar 29, 8:50 pm, "maina...@gmail.com" <maina...@gmail.com> wrote: > r4rs interpreter or compiler should be able to compile or interpret > r5rs reference code right? No actually. At least not directly. What ...

program that compiles in C compiler but not in C++ compiler
Hi, I need a small program that compiles in C compiler but not in C++ compiler. Thx in advans, Karthik Balaguru KBG <karthik.balaguru@lntinfotech.com> wrote: > I need a small program that compiles in C compiler but not in C++ > compiler. No problem, just send $10 to paypal@zevv.nl and I'll do your homework for you. -- :wq ^X^Cy^K^X^C^C^C^C KBG said: > Hi, > > I need a small program that compiles in C compiler but not in C++ > compiler. Can you think of any syntactic differences between C and C++? For example, what about keywords? They are very, very sen...

Writing a compiler compiler
Hello, Firstly, let it be known that I am quite new to the subject of parser generators, and having written only simple parsers for frivoulous grammars by hand have little experience. My objective is thus - to create a parser generator that will eventually generate a parser for a dynamic language. However, my undestanding of different parser types and distinctions between is minimal; but as the web is a good enough resourse please assume my knowledge of those areas. The target for this parser generator would be a language similar to C#, and I have found Jay (a yacc clone to C# and Java). Th...

Compiling with the eclipse compiler
Hey all,I have a weird problem (at least it's weird to me).I have a big project that I need to compile through ant with eclipse'scompiler.In the build.xml my compile target looks like this : <target name="compile" depends="release-settings, init" description="compiles everything from source"> <echo message="Compiling with debug = ${build.debug}"/> <depend srcdir="${src.dir}" destdir="${class.dir}" cache="${dependencies.dir}" closure="true"/> <javac srcdir=...

compiling on different compilers
I am working on a set of functions that involve dynamic memory allocation. I started working with gcc and then moved to Pacific C. The reason was that my only access to gcc was through an ssh connection that I did not have access to all the time, so I got Pacific so I could work on my home windows computer. Then I moved back to gcc, which saved me from some major mistakes. Somehow Pacific C was letting me get away with stuff that was completely wrong. gcc immediately gave me segmentation errors until I got every last thing correct. Is gcc the best for catching mistakes? If not, which on...

Meta4... a compiler-compiler
in the csa2 gmail account... description is very interesting. in the Pidgin for Apple II/Merlin/6502 message Rich ...

which compiler was used to compile?
Is there a slick way to invent a constant in a program that tells you which compiler you used. I distribute both JET and JavaC versions of my code, and it helps to know on any error dump which version they were using. Right now I manually change a static final just before compiling. I thought there ought to be something less error prone. -- Canadian Mind Products, Roedy Green. Coaching, problem solving, economical contract programming. See http://mindprod.com/jgloss/jgloss.html for The Java Glossary. Roedy Green wrote: > Is there a slick way to invent a constant in a program that tell...

Web resources about - Decompilable interpreter/compiler hybrid - comp.compilers

The Alpha-funded Zombie Survival RPG
Is this some kind of elaborate hoax? No it’s not. What started with a very early and rough Christmas multiplayer test between Lemmy and Binky ...

Dear Google, your app store has a decompiling problem
... Problem with Decompiling My team and I recently conducted a thorough search for Android apps on Google Play that can be decompiled. A decompilable ...

Resources last updated: 1/24/2016 6:37:14 AM