Why does c++ need a compiler? Does ruby use a compiler?

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
Levio91
Chaos Rift Regular
Chaos Rift Regular
Posts: 119
Joined: Thu Nov 06, 2008 9:50 pm

Why does c++ need a compiler? Does ruby use a compiler?

Post by Levio91 »

Why does c++ need a compiler, and html doesnt? does ruby need a compiler, if not then what did I even download?

Link to what I thought was a ruby compiler. http://www.ruby-lang.org/en/downloads/

a confused person.
"Criticism is something you can avoid easily by saying nothing, doing nothing, and being nothing. " - Aristotle

http://www.facebook.com/profile.php?id= ... ef=profile
Image
User avatar
ismetteren
Chaos Rift Junior
Chaos Rift Junior
Posts: 276
Joined: Mon Jul 21, 2008 4:13 pm

Re: Why does c++ need a compiler? Does ruby use a compiler?

Post by ismetteren »

Im am not an expert, and a can give you the fully correct explanation.

But basicly; when you compile a c++ file, the compiler makes it into an executeable .exe file, wich your computer can run. HTML dosent have to be translated into anything else for your browser to read it.

I am not sure if ruby gets compiled...
(i dont know if the thing you linked to is a compiler. It might be a libary(a set of basic funtions))
Image ImageImage Image
User avatar
Moosader
Game Developer
Game Developer
Posts: 1081
Joined: Wed May 07, 2008 12:29 am
Current Project: Find out at: http://www.youtube.com/coderrach
Favorite Gaming Platforms: PC, NES, SNES, PS2, PS1, DS, PSP, X360, WII
Programming Language of Choice: C++
Location: Kansas City
Contact:

Re: Why does c++ need a compiler? Does ruby use a compiler?

Post by Moosader »

ismetteren wrote:Im am not an expert, and a can give you the fully correct explanation.

But basicly; when you compile a c++ file, the compiler makes it into an executeable .exe file, wich your computer can run.
Also note that this is required because Windows, Mac, and Linux all read different file types when they run, so they would have to be compiled specially for each.

A compiler takes your code and essentially converts it into Assembler code. The machine doesn't understand C++, but it understands Assembler and Machine Language.

Some languages are scripting languages and, instead of a compile, they have an interpreter. An Interpreter will not generally compile or mess with the code beforehand, it just starts at the starting place, reads each line, and executes it as it comes up. If something's wrong, THEN it complains. Visual Basic, Python, and Lua are scripting languages.
No idea about Ruby.
exor674
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 5
Joined: Sat Nov 29, 2008 3:06 am

Re: Why does c++ need a compiler? Does ruby use a compiler?

Post by exor674 »

Ruby is a scripting language too.

Technically, you could think of a browser as the "compiler" for HTML, if you use the term compiler loosely.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Why does c++ need a compiler? Does ruby use a compiler?

Post by Falco Girgis »

Ruby is interpreted, not compiled. It's a scripting language just like Perl, Lua, Python, etc.

HTML is "interpreted" by your browser.
Andy K.
Chaos Rift Junior
Chaos Rift Junior
Posts: 262
Joined: Sat Nov 29, 2008 6:15 pm
Location: Winchester, VA

Re: Why does c++ need a compiler? Does ruby use a compiler?

Post by Andy K. »

I've only ever used Ruby in scripts, and then had a language or program use the scripts, but never complied it to an executable. Although, I am pretty sure it can/has be done. I'd have to research more, Ruby is not one of my go to scripts.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Why does c++ need a compiler? Does ruby use a compiler?

Post by Falco Girgis »

Ruby, Perl, Lua, and those kinds of scriping languages can be "compiled" into executables in a sense. It's not the same as compiling a C/++ program. You are basically packaging your script with its executable interpreter into a single executable file. Your script is still being interpreted. It's not magically becoming a compilable language.
Andy K.
Chaos Rift Junior
Chaos Rift Junior
Posts: 262
Joined: Sat Nov 29, 2008 6:15 pm
Location: Winchester, VA

Re: Why does c++ need a compiler? Does ruby use a compiler?

Post by Andy K. »

GyroVorbis wrote:Ruby, Perl, Lua, and those kinds of scriping languages can be "compiled" into executables in a sense. It's not the same as compiling a C/++ program. You are basically packaging your script with its executable interpreter into a single executable file. Your script is still being interpreted. It's not magically becoming a compilable language.
yeah that's kinda what I meant, sorry I wasn't more clearer :lol:
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: Why does c++ need a compiler? Does ruby use a compiler?

Post by avansc »

Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
User avatar
mllarson
Chaos Rift Regular
Chaos Rift Regular
Posts: 183
Joined: Fri Nov 14, 2008 5:20 pm
Location: Minnesota, where "Cold as Hell" has real meaning...

Re: Why does c++ need a compiler? Does ruby use a compiler?

Post by mllarson »

A scripting language is interpreted by another program. In other words, it is "looked at" by a program to see what tasks are supposed to be done. This type of language is slower than compiled. A compiled language is one that is looked at by a compiler program, and then translated into the machine's native instruction set. Certain scripting languages like PHP have a compiler to make it faster to run. Basically scripts are used to make anything that you'd want to run on any type of computer. Compiled programs, however, only work on the CPU type they were compiled for. Hope that helped more than it confused.

-Matt
"Mmmm... these paint chips are scrumptious!"
Post Reply