Languages

Started by
14 comments, last by rip-off 12 years, 10 months ago
So I'm already familiar with Java and C++, and I know there are a lot of other languages used to program games (python, etc.) But I've never been able to figure out how to actually run these programs without some kind of installation (java->eclipse, cpp->visual cpp). Even so, one of my computers lacks javac in command prompt, yet it can run an embedded java applet on a webpage. I doubt it has cmake, yet I found a piece of software in c++ that ran fine on my computer. So my main question is, how is it done?

Being able to run code without anything installed has always been something I've been looking for (do NOT tell me to write a compiler). So I've been learning batch for a few days until I found out it's a scripting language, and not a programming language. Assembly is apparently the most basic language, and I'd gladly learn it if I could figure out how to run it.

So are there any really low level languages that games are programmable in (by low level, I mean no compile software installation required, just write code in notepad, and run)? Complexity of the code is not really an issue for me, (I'm probably going to regret saying that when someone says to use assembly to write pong), so much as ease of running, and runtime quickness.

Edit: Resolved. Didn't feel like bumping, so I put here. Thanks to all for explaining how compiling works, and thanks to rip-off, I'll look into portable JRE, that was actually exactly what I was trying to find!
A penny for my thoughts? Do you think I have only half a brain?

Not-so-proud owner of blog: http://agathokakologicalartolater.wordpress.com/
Advertisement
Generally, "no".

You can't just write code in a text editor and run it, even a batch file scripting language needs some kind of interpreter behind it (which may or may not be built in to the OS). What you can do is compile code to an executable and then distribute that executable; other people will be able to run it without needing the build environment installed (assuming that it compiles to a native executable - Java/C# typically don't for example, whereas C or C++ typically do).

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

You're conflating lots of different concepts.

Installation vs Non-installation:
Some applications require an installation. This means the executable you download and run to install the application is not actually the application -- though it contains it (or somehow fetches it). The installer puts files where they need to be. It may put the application in C:\Program Files(x86)\, or it might let you choose where to put it. It might have to put shared libraries in the right places, or it might have to modify the registry in some way.

Other applications are written to be entirely self-contained and stand-alone. In that case the executable you download and run is the application. You can run it from any location on the disk because it doesn't have all the dependencies that the installed application required the installer to set up.

Installation vs Compiling
Installing an application usually doesn't compile it (with the notable exception of many unix/linux platforms). It comes to you already in executable form. You can't see the source code because whoever created the application already compiled it. You say you can't figure out how to run java programs without installing eclipse or "cpp programs" without installing Visual C++. This makes no sense at all. First of all, you don't need Eclipse to compile java programs, you just need a java compiler. Eclipse is a java IDE (which may or may not provide its own java compiler, I don't know, I don't use java). Secondly, you don't need to compile a java program to run it. If you've received a java program it's probably java bytecode, which can be run directly through your java runtime. Thirdly, a compiled C++ program is simply an executable. It's native code that runs directly on the platform (hardware), not through any runtime. You never need anything (aside from dynamic library dependencies, or other sorts of runtime dependencies) to run a compiled C++ program.

Compiled languages vs Interpreted languages
A compiled language is one like C++ or Java that you have to compile. The compilation step turns your source code into binary object code that can be executed on your machine. An interpreted language doesn't require any such step. Instead, the source code is read by an executable and the commands in the source code are then performed by that executable. This includes most scripting languages. A scripting language is a programming language by the way, contrary to your false dichotomy.

I think what you're asking is:
Are there any languages that I can write a program in that don't have to be compiled or interpreted. The answer is yes, machine code. Even writing in assembly language required an assembler, which translates what you wrote into machine language for the platform you're on. If you are planning to write machine code you will have to write it in binary or hexadecimal, and you will have to know the opcodes and keep track of your own memory addresses. You won't be able to use notepad, since that outputs ascii. It will be a bunch of numbers. You don't want to do that.

So why are you trying to do what you're trying to do? Why do you hate installing things?

You also asked how an embedded java applet runs on your computer without having installed javac. Easy, you don't have to compile a java application to be able to run one. You're downloading java bytecode which is then interpreted by your java runtime. The javac would simply turn java sourcecode into bytecode.
Punch cards.

...

No, really, if this is just for personal fun, why not go explore some extreme retro-computers? (I assume it's for personal fun since it's otherwise a nonsensical demand.)
Your definition of low level is really really really bad, as low level is already well defined in the world of computer programming. ( Low level refers to the level of abstraction between the programming language and the under-lying hardware, with low level languages being the least abstracted ).


Truth is though, I don't think you really understand the compilation process. All code at some point is translated from text form into machine runnable ( for virtual machine runnable ) format, or is run within a hosted environment ( like BATCH programming run within CMD.exe process ). Even assembly code is run through an assembler to create an executable program.



One thing you should look into is Static Linking, which allows you to pack all the required libraries and files into a single EXE file. Frankly if you want to create small, portable, self contained code, C is what you are looking for. That said, I would rather cut off my own manhood than work in C again.

You're conflating lots of different concepts.

The installer puts files where they need to be. It may put the application in C:\Program Files(x86)\, or it might let you choose where to put it.



Your definition of low level is really really really bad.

Truth is though, I don't think you really understand the compilation process.



if this is just for personal fun


Yes... I'm fairly able as a programmer in java, but I'm totally lost when it comes to computer science theory with the compilers and interpreters and everything. My main issue is school computers which don't seem to have any way of running code that is written on the spot. It is partially just for personal fun, as I can write java in text and move it between computers all the same, but it'd be nice to be able to run it from a school computer. Is there any chance of being able to directly write an exe or jar file, or is just not worth the effort?

@A Brain in a Vat: So if something were installed onto a flash drive, could it still run, even though it's not on the actual computer?
A penny for my thoughts? Do you think I have only half a brain?

Not-so-proud owner of blog: http://agathokakologicalartolater.wordpress.com/

Yes... I'm fairly able as a programmer in java, but I'm totally lost when it comes to computer science theory with the compilers and interpreters and everything. My main issue is school computers which don't seem to have any way of running code that is written on the spot. It is partially just for personal fun, as I can write java in text and move it between computers all the same, but it'd be nice to be able to run it from a school computer. Is there any chance of being able to directly write an exe or jar file, or is just not worth the effort?

@A Brain in a Vat: So if something were installed onto a flash drive, could it still run, even though it's not on the actual computer?

If an executable was on a flash drive, and then you connected that flash drive to the computer, then yes that executable could run on the computer.

That doesn't mean your school doesn't have some kind of protection against that possibility.

So are you not learning to program in school? Because if you are they should provide systems with compilers on them.

If they don't, you'll just have to install a compiler on your home computer, and if you don't have one you'll just have to get one.

Assembly is apparently the most basic language, and I'd gladly learn it if I could figure out how to run it.


ASM is the most basic language in the sense that a CPU can understand and execute it. The actual programming of ASM is not so basic.

For future reference, you can run ASM inside of Visual Studio. See here for more information.

ASM is the most basic language in the sense that a CPU can understand and execute it. The actual programming of ASM is not so basic.

For future reference, you can run ASM inside of Visual Studio. See here for more information.

This is not true. A CPU cannot understand and execute assembly. Please read what I wrote above.

[quote name='HelloSkitty' timestamp='1309371686' post='4829182']
Assembly is apparently the most basic language, and I'd gladly learn it if I could figure out how to run it.


ASM is the most basic language in the sense that a CPU can understand and execute it. The actual programming of ASM is not so basic.

For future reference, you can run ASM inside of Visual Studio. See here for more information.
[/quote]


This actually, is wrong. ASM is about as low level as languages get, but it is not machine executable, it still gets compiled down to machine code and linked with the appropriate headers etc depending on format ( such as ELF on Linux or PE on Windows ).



EDIT: Damn your quickness Brain!

This topic is closed to new replies.

Advertisement