Platform independent, lightweight programming language

I need to write an extremely lightweight program (trying to get below 8Kb) that does some simple math. The language must also be platform independent. Which language do you think will work best? (Oh, and no framework is allowed.)

+4
source share
12 answers

C. Of course, you need to build separately for each platform, but other than that, it is quite lightweight and platform independent (or multi-platform, depending on which expression you prefer).

+7
source

What platforms are targeted for programs?

So far, we have had the following requirements:

  • The program should be no more than 8 kilobytes.
  • Must be platform independent.
  • No frameworks allowed.

Here are a few questions:

  • Can an 8K program be a script for a scripting language?
  • How big is the runtime for the program?
  • Should the program have to be its own code on its own?
  • What target platforms should the code run on?
  • Is cross-compiling code for each platform an option?

The questions that I presented will affect the options you want. If the program should be 8 kilobytes with the runtime, then there really is not much choice but compilation against the target environment.

If the target is an embedded device or non-x86, then the likelihood that the choice will be further limited will be limited. Small embeddable langugages, such as Lua, can still be used (written in C), but it takes a rather long "run time" to execute the script.

If cross-compiling for purposes is an option, then writing a C program and compiling on each target platform is likely to produce fairly small native programs.

In accordance with current requirements, there are several questions that need to be addressed, providing a good comprehensive answer. Beyond this, the best you can do is brainstorm options that may or may not lead to the solution you want.

+4
source

Can I use a browser based browser? Lightweight and works on almost all platforms through a browser.

+3
source

Lua is a cross-platform and very light weight.

+3
source

How about Forth ?

+3
source

Are you thinking of something like pico ?

+2
source

c or assembly (although you will need to compile for each platform)

TCL is a cross-platform scripting language (not sure how easy it is)

I would suggest Java, but the VM is likely to overcome your size requirements

+1
source

dc

This is basically a bloated calculator, but it is 25K and zips up to 12K. It also performs some string operations, macros, and starts external processes. You will not find much less without writing it yourself. Source and win32 files are available.

+1
source

Not sure what you mean by the framework?

python

why?

  • It installs on my Linux, OSX distributions and can be packaged as a native executable on Windows. In other words, the user of your application does not need to install anything
  • It is very easy to find out.
0
source

Bespin from Mozzila is an online medium. So, by definition, the platform is independent. Try https://bespin.mozilla.com/

0
source

Even C requires runtime. The only realistic answer to this question is dc or even your own calculator that runs scripts implemented in C. (Such a calculator may be smaller than dc if it does not depend on arbituary accuracy).

0
source

You would be surprised how much you can do in less than 4k Java:

http://www.java4k.com/

Of course, this does not include the JVM :-)

0
source

Source: https://habr.com/ru/post/1286059/


All Articles