views:

1167

answers:

11

I'm looking for a compiler or interpreter for a language with basic math support and File IO which can be executed directly from a memorystick in either Linux or Windows. Built in functionality for basic datastructures and sorting/searching would be a plus.

(I've read about movable python, but it only supports windows)

Thank you

+7  A: 

Not sure what are the issues there for the other languages, but I am pretty sure that Lua will work fine on such environment.

It is perfect for your requirements: basic I/O, math functions, excellent data structures (all based on numeric and associative array, with any kind of key/values, allowing the most complex operations).
Bonus: very simple to learn (for the bases, at least), readable, and powerful when you start to dig. And it starts to have a number of useful libraries, sockets, regexes and parsers, GUI, etc.

It is just a single binary file, no install at all, no registry access, no file access (beyond reading the binary and script!) if not requested, totally transparent: it is often used in embedded system, often memory constrained, on Roms, etc.

PhiLho
Thanks, i just happened to read about Lua in another question about game-programming, so I was just reading about it. Does it install on a USB-stick.
tovare
I just expanded my answer. I didn't tried to install it on a stick, but I see no issue there. It costs nothing to try (Lua is small!).
PhiLho
Yes, it is perfect for my requirements :-) Thanks man.
tovare
+1  A: 

Not sure if it still applies to current versions, but I have an ancient perl.exe (version 5.001, from 1994 or 1995) that still works perfectly fine as a no-installation single executable.

Arnout
Thanks for the suggestion.
tovare
A: 

Not sure that I understand the question: what would keep you from putting any language on a memory stick? You're going to have to put both Linux and Windows binaries if you want both, but that shouldn't be an issue. If you really want portability, you could go the route I did, and put a full Linux install with Java/Eclipse on an 8Gb stick.

kdgregory
System admins which don't allow installation of software would keep me from a lot of things. Most forget to disable USB :-) I use putty to my own shell today, but for instance generate a file and import the contents to excel is a hassle, a programming enviroment on a stick would solve things.
tovare
And as I said, you can do that with pretty much any language -- perhaps not with a MS product that expects registry keys, but pretty much anything else. For another example, look at Cygwin: http://www.cygwin.com/, which gives you all the GNU tools for Windows
kdgregory
A: 

Why not C++? You can statically link in any external librarys assuming there lisence allows it, and you won't have any external dependencies.

Jared
That would be like creating software capable of running on a memorystick. The use case is write,run and revise my own code anywhere.
tovare
+2  A: 

The Java JDK easily fits on a stick, and does not require installation; You can install it to a PC first and then just copy the install directory to the stick. I presume you can do the same for the Linux JDK.

And there's a ton of good text editors that don't require installation.

Software Monkey
Thanks, I didn't know this. I though java required registry access.
tovare
Yeah, but I wanna see you develop Java in a simple text editor...Of course you can use eclipse too, but JRE for win and linux + eclipse for win and linux is about 1GB, and a bit clumsy...
abyx
@abyx: Actually, I *do* use a simple text editor (TextPad) to develop Java.
Software Monkey
You can use eclipse in a portable way, look here: http://portableapps.com/node/929
Peter
+1  A: 

If you can tolerate TCL, it's hard to beat a tclkit

wrt
Thanks that would work as well. I'll give Lua a shot first though :-)
tovare
+2  A: 

There is a python distribution called Movable Python which is designed to do exactly that. It might do what you want. Also, MinGW/MSYS will run on Windows with no registry entries or other installation beyond placing the files in a directory tree - all you need to do is set up the relevant directories in the path, which can be done in a batch file.

ConcernedOfTunbridgeWells
Did you read the whole question?
BobbyShaftoe
A: 

TCC (the Tiny C Compiler) is a full implementation of C in a really small package. You can even write shell scripts in C:

#!/usr/local/bin/tcc -run
#include <stdio.h>

int main() 
{
    printf("Hello World\n");
    return 0;
}

TCC is available for any Unix-like platform, and also for Windows.

Greg Hewgill
Greg - Assuming this compiles the C code, where does the output go? Or does TCC interpret??
Software Monkey
Wherever you tell it to go
nos
A: 

http://smallbasic.sourceforge.net/

Runs anywhere (even mobiles) and has everything you need.

Jon Romero
Looks like a fun BASIC implementation, it appears to require installation.
tovare
it is possible to just copy the installation folder to usb.
Jon Romero
+1  A: 

I've done exactly that with Ruby. Worked well.

Jim Blizard
+1  A: 

I'm way late for this party, but I thought I'd weigh in anyway.

I currently have a Windows-usable USB stick with the following installed on it (for Windows):

Languages

  • Java
  • Erlang
  • Fantom
  • Groovy
  • Haskell
  • jacl (JVM-based Tcl)
  • JavaFX
  • JRuby (JVM-based Ruby)
  • Jython (JVM-based Python)
  • NASM
  • nice
  • pnuts
  • Rexx
  • Scala
  • SISC (JVM-based Scheme)
  • Sleep
  • Tcl
  • Prolog
  • gawk (via GnuWin32 and MinGW/MSys)
  • jawk (JVM-based AWK)
  • ANTLR
  • Clojure
  • JBasic (JVM-based BASIC)
  • Tuprolog (JVM-based Prolog)
  • Rhino (JVM-based Javascript)
  • YASM
  • Lua
  • Kahlua (JVM-based Lua)
  • C (via GnuWin32 and MinGW/MSys)
  • C++ (via GnuWin32 and MinGW/MSys)
  • Fortran77 (via GnuWin32 and MinGW/MSys)
  • Ada (via GnuWin32 and MinGW/MSys)

Programming Tools

  • jEdit (JVM-based programmer's editor)
  • Ant (JVM-based build tool)
  • Maven 2 (JVM-based build tool)
  • vi (via GnuWin32 and MinGW/MSys)
  • Vim
  • CMake
  • gmake (via GnuWin32 and MinGW/MSys)
  • Leiningen
  • Subversion
  • Fossil
  • ANTLRworks
  • ctags/etags

Geek Toys

  • All SIMH emulators, with networking if available
  • Several operating systems, utilities, etc. for same

And a cast of dozens in key libraries, plus the Geronimo application server.

Yes, this is a single USB stick, and I probably missed an item here or there while making this list. It's amazing what you can run off of a USB stick these days.

JUST MY correct OPINION
What's the size of all of this ?
Leonel
@Leonel: Since I posted that I've added Factor, Yap, Hudson and some SQLite tools to the mix, so my current mix of languages, development tools and geek toys weighs in at just under 4GB on disk. (Actual data size is closer to 3.2GB, but slack space accounts for a lot there.)
JUST MY correct OPINION