This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Learning to write a compiler
I looked around trying to find out more about programming language development, but couldn't find a whole lot online. I have found some tutorial videos, but not much for text guides, FAQs, advice etc. I am really curious about how to build my own programming language. It brings me to SO to ask:
How can you go about making your own programming language?
I would like to build a very basic language. I don't plan on having a very good language, nor do I think it will be used by anyone. I simply want to make my own language to learn more about operating systems, programming, and become better at everything.
Where does one start? Building the syntax? Building a compiler? What skills are needed? A lot of assembly and understanding of the operating system? What languages are most compilers and languages built in? I assume C.
I'd say that before you begin you might want to take a look at the Dragon Book and/or Programming Language Pragmatics. That will ground you in the theory of programming languages. The books cover compilation, and interpretation, and will enable you to build all the tools that would be needed to make a basic programming language.
I don't know how much assembly language you know, but unless you're rather comfortable with some dialect of assembly language programming I'd advise you against trying to write a compiler that compiles down to assembly code, as it's quite a bit of a challenge. You mentioned earlier that you're familiar wtih both C and C++, so perhaps you can write a compiler that compiles down to C or C++ and then use gcc/g++ or any other C/C++ compiler to convert the code to a native executable. This is what the Vala programming language does (it converts Vala syntax to C code that uses the GObject library).
As for what you can use to write the compiler, you have a lot of options. You could write it by hand in C or C++, or in order to simplify development you could use a higher level language so that you can focus on the writing of the compiler more than the memory allocations and the such that are needed for working with strings in C.
You could simply generate the grammars and have Flex and Bison generate the parser and lexical analyser. This is really useful as it allows you to do iterative development to quickly work on getting a working compiler.
Another option you have is to use ANTLR to generate your parser, the advantage to this is that you get lots of target languages that ANTLR can compile to. I've never used this but I've heard a lot about it.
Furthermore if you'd like a better grounding on the models that are used so frequently in programming language compiler/scanner/parser construction you should get a book on the Models of Computation. I'd recommend Introduction to the Theory of Computation.
You also seem to show an interest in gaining an understanding of operating systems. This I would say is something that is separate from Programming Language Design, and should be pursued separately. The book Principles of Modern Operating Systems is a pretty good starting place for learning about that. You could start with small projects like creating a shell, or writing a programme that emulates the ls command, and then go into more low level things, depending on how through you are with the system calls in C.
I hope that helps you.
EDIT: I've learnt a lot since I write this answer. I was taking the online course on programming languages that Brown University was offering when I saw this answer featured there. The professor very rightly points out that this answer talks a lot about parsers but is light on just about everything else. I'd really suggest going through the course videos and exercises if you'd like to get a better idea on how to create a programming language.
It entirely depends on what your programming language is going to be like.
Do you definitely want it to be compiled? There are interpreted languages as well... or you could implement compilation at execution time
What do you want the target platform to be? Some options:
Native code (which architectures and operating systems?)
JVM
Regular .NET
.NET using the Dynamic Language Runtime (like IronRuby/IronPython)
Parrot
Personally I would strongly consider targeting the JVM or .NET, just because then you get a lot of "safety" for free, as well as a huge set of libraries your language can use. (Obviously with native code there are plenty of libraries too, but I suspect that getting the interoperability between them right may be trickier.)
I see no reason why you'd particularly want to write a compiler (or other part of the system) in C, especially if it's only for educational purposes (so you don't need a 100-million-lines-a-second compiler). What language are you personally most productive in?
Take a look at ANTLR. It is an awesome compiler-compiler the stuff you use to build a parser for a language.
Building a language is basically about defining a grammar and adding production rules to this grammar. Doing that by hand is not trivial, but a good compiler-compiler will help you a lot.
You might also want to have a look at the classic "Dragon Book" (a book about compilers that features a knight slaying a dragon on the front page). (Google it).
Building domain specific languages is a useful skill to master. Domain specific languages is typically not full featured programming language, but typically business rules formulated in a custom made language tailor made for the project. Have a look at that topic too.
There are various tutorials online such as Write Yourself a Scheme in 48 hrs.
One place to start tho' might be with an "embedded domain specific language" (EDSL). This is a language that actually runs within the environment of another, but you have created keywords, operators, etc particularly suited to the subject (domain) that you want to work in.
This question already has answers here:
Closed 13 years ago.
Possible Duplicates:
How to get kids into programming
Suggestions on starting a child programming.
Is there a really simple programming language that I can use to teach my 6 year old son concepts of programming, syntax and logic?
I'm probably the only one here with this opinion, but I think 6 is too young to start a child on programming. Those years are critical for development of a whole host of skills including social skills that are not computer-related (that, indeed, may be antithetical to computer use) and intellectual ones that actually will contributed to computing skills later on (I'm talking about math and problem solving skills).
I've started introducing my kids to programming at the ages of 8 and 10, but I don't expect them to take a serious interest in it until their middle school years (starting at age 11/12). In general my kids spend much, much less time in front of a computer than their classmates. They both lead their classes academically and are well socially adjusted.
Logo. Designed specifically by Seymour Papert to teach children how to program how to deal with recursion etc. etc. all without using those words to put people of. Particularly when linked to turtle graphics to give a readily available and recognisable output and feedback.
Because it was designed to cover all the fundamentals in programming it does not necessarily major in anything, but the ides is to give the children all the core fundamentals.
Try Scratch.
Take a look at Small Basic from Microsoft.
By providing a small and easy to learn
programming language in a friendly and
inviting development environment,
Small Basic makes programming a
breeze. Ideal for kids and adults
alike, Small Basic helps beginners
take the first step into the wonderful
world of programming.
I think the quote sums it up, really! :)
Yes, there is Plain English Programming Language
Check out www.pythonturtle.org
Guido van Robot is a logo like application that uses Python.
(source: sourceforge.net)
I suggest python via Snake Wrangling for Kids:
“Snake Wrangling for Kids” is a
printable electronic book, for
children 8 years and older, who would
like to learn computer programming. It
covers the very basics of programming,
and uses the Python 3 programming
language to teach the concepts.
Personally I think Tcl is perfect as a beginning language, especially for young people. It has an interactive console for instant gratification, and tk is by far one of the easiest GUI toolkits on the planet. One or two lines of code to see a window on a screen. Just a couple lines of code to create a canvas and draw rudimentary shapes, etc.
I know many people don't like Tcl, but I think that's more out of ignorance than anything else. And I mean that in a good way -- if you don't understand Tcl but know more traditional languages, it's hard to see the beauty in such a simple yet powerful language. The whole definition of the language fits in a single man page, so it's easy to grasp the fundamentals.
Finally, as a teaching tool it lets you recreate just about any language construct you wish. You can not only show them for and while loops, you can create repeat/until loops, or anything other types of looping to emulate other languages.
I started learning programming in the hey-day of Pascal, a language which many would say is designed for learning. Here's a quote from Wikipedia:
Criticism
While very popular (although more so in the 1980s and early 1990s than now), implementations of Pascal which closely followed Wirth's initial definition of the language were widely criticized for being unsuitable for use outside of teaching.
Take that for what you will =)
turbo pascal? :) gwbasic? and nextly python :)
Well, Python has very English like syntax that makes it relatively easy to pick up. Python IDLE works in a read-eval-loop mode, so you don't have to go through compiling or anything. You can type code in line-by-line and get instant feedback. It also has an interactive help mode. If he needed to know what some function does, and you weren't there to help him, he could just type help(someFunction)
There was a comment about how it can become confusing when you mix tabs and spaces in Python. In response to that comment, most editors have an option to automatically replace tabs with X spaces. In IDLE, it's as simple as Format->Toggle Tabs to make it so whenever you press the tab key, it inserts 8 spaces instead of a tab.
Labview is completely visual. It's mainly used to program robots. It's extremely logic oriented. However, there's quite a big price tag on it.
SmallTalk. It was created for educational use.
I have to agree that six years old sounds a bit young though... if they don't want to learn, don't try to force them.
I think the framework is important too. Your kid should be able to create a game without too much ado. Python + pygame springs to mind.
http://en.wikipedia.org/wiki/Logo_(programming_language)
I am trying to understand how a language interpreter works. Can you guys point me the general lines on how an interpreter works?
I mean, suppose I have some lines written like this
10 x = 200;
20 for r = x to 1000 step 1
25 z = r + 32;
30 print z;
40 next r;
50 end;
what's the best way to build an interpreter that could run something like that?
Having a large matrix containing all functions allowed and searching for a match? The first line, for example: it is assigning 200 to a variable x, but these are symbols that does not exist.
If you guys can give me the direction...
Thanks for any help.
Compiler creation is a complex topic (an interpreter can be seen as a special compiler).
You have to first parse it - try to understand the syntax and then create some internal representation (abstract syntax tree) and then create some execution logic.
Wikpedia suggests http://mcs.une.edu.au/~comp319/
I know this is an old thread but most of the related questions are marked as duplicate or closed. So, here are my two cents.
I am surprised no one has mentioned xtext yet. It is available as Eclipse plugin and IntelliJ plugin. It provides not just the parser like ANTLR but the whole pipeline (including parser, linker, typechecker, compiler) needed for a DSL. You can check it's source code on Github for understanding how, an interpreter/compiler works.
Perhaps you are talking about creating a DSL.
You might find this helpful (if you are ok with spending $$)
http://gilesbowkett.blogspot.com/2010/03/create-your-own-programming-language.html
I'm interested in learning more about this as well. I found Douglas Crockford's JavaScript parser interesting, though from what I understand he's using a different method than is typical for parsing languages. It's not the full picture for interpreting and compiling, but I found it helpful to see some actual parsing implementation and the resulting restructuring of the code.
you can find an open source 'Gold Parsing System' at http://goldparser.org. :)
there are some explained concepts on their site too where you can learn some rudimentary basics of the process.
Learn about tools such as lex/flex and yacc/bison. These are most popular tools for building compilers in open software world. Many well known open source programs are written using them (including PHP, gcc, doxygen). You'll find a lot of free books and tutorials. They not only show how to use lex and yacc tools, but also explain general ideas behind compilers.
Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions.
It wasn't that long ago that I was a beginning coder, trying to find good books/tutorials on languages I wanted to learn. Even still, there are times I need to pick up a language relatively quickly for a new project I am working on. The point of this post is to document some of the best tutorials and books for these languages. I will start the list with the best I can find, but hope you guys out there can help with better suggestions/new languages. Here is what I found:
Since this is now wiki editable, I am giving control up to the community. If you have a suggestion, please put it in this section. I decided to also add a section for general be a better programmer books and online references as well. Once again, all recommendations are welcome.
General Programming
Online Tutorials
Foundations of Programming By Karl Seguin - From Codebetter, its C# based but the ideas ring true across the board, can't believe no-one's posted this yet actually.
How to Write Unmaintainable Code - An anti manual that teaches you how to write code in the most unmaintable way possible. It would be funny if a lot of these suggestions didn't ring so true.
The Programming Section of Wiki Books - suggested by Jim Robert as having a large amount of books/tutorials on multiple languages in various stages of completion
Just the Basics To get a feel for a language.
Books
Code Complete - This book goes without saying, it is truely brilliant in too many ways to mention.
The Pragmatic Programmer - The next best thing to working with a master coder, teaching you everything they know.
Mastering Regular Expressions - Regular Expressions are an essential tool in every programmer's toolbox. This book, recommended by Patrick Lozzi is a great way to learn what they are capable of.
Algorithms in C, C++, and Java - A great way to learn all the classic algorithms if you find Knuth's books a bit too in depth.
C
Online Tutorials
This tutorial seems to pretty consise and thourough, looked over the material and seems to be pretty good. Not sure how friendly it would be to new programmers though.
Books
K&R C - a classic for sure. It might be argued that all programmers should read it.
C Primer Plus - Suggested by Imran as being the ultimate C book for beginning programmers.
C: A Reference Manual - A great reference recommended by Patrick Lozzi.
C++
Online Tutorials
The tutorial on cplusplus.com seems to be the most complete. I found another tutorial here but it doesn't include topics like polymorphism, which I believe is essential. If you are coming from C, this tutorial might be the best for you.
Another useful tutorial, C++ Annotation. In Ubuntu family you can get the ebook on multiple format(pdf, txt, Postscript, and LaTex) by installing c++-annotation package from Synaptic(installed package can be found in /usr/share/doc/c++-annotation/.
Books
The C++ Programming Language - crucial for any C++ programmer.
C++ Primer Plus - Orginally added as a typo, but the amazon reviews are so good, I am going to keep it here until someone says it is a dud.
Effective C++ - Ways to improve your C++ programs.
More Effective C++ - Continuation of Effective C++.
Effective STL - Ways to improve your use of the STL.
Thinking in C++ - Great book, both volumes. Written by Bruce Eckel and Chuck Ellison.
Programming: Principles and Practice Using C++ - Stroustrup's introduction to C++.
Accelerated C++ - Andy Koenig and Barbara Moo - An excellent introduction to C++ that doesn't treat C++ as "C with extra bits bolted on", in fact you dive straight in and start using STL early on.
Forth
Books
FORTH, a text and reference. Mahlon G. Kelly and Nicholas
Spies. ISBN 0-13-326349-5 / ISBN 0-13-326331-2. 1986
Prentice-Hall. Leo Brodie's books are good but this book
is even better. For instance it covers defining words and
the interpreter in depth.
Java
Online Tutorials
Sun's Java Tutorials - An official tutorial that seems thourough, but I am not a java expert. You guys know of any better ones?
Books
Head First Java - Recommended as a great introductory text by Patrick Lozzi.
Effective Java - Recommended by pek as a great intermediate text.
Core Java Volume 1 and Core Java Volume 2 - Suggested by FreeMemory as some of the best java references available.
Java Concurrency in Practice - Recommended by MDC as great resource for concurrent programming in Java.
The Java Programing Language
Python
Online Tutorials
Python.org - The online documentation for this language is pretty good. If you know of any better let me know.
Dive Into Python - Suggested by Nickola. Seems to be a python book online.
Perl
Online Tutorials
perldoc perl - This is how I personally got started with the language, and I don't think you will be able to beat it.
Books
Learning Perl - a great way to introduce yourself to the language.
Programming Perl - greatly referred to as the Perl Bible. Essential reference for any serious perl programmer.
Perl Cookbook - A great book that has solutions to many common problems.
Modern Perl Programming - newly released, contains the latest wisdom on modern techniques and tools, including Moose and DBIx::Class.
Ruby
Online Tutorials
Adam Mika suggested Why's (Poignant) Guide to Ruby but after taking a look at it, I don't know if it is for everyone.
Found this site which seems to offer several tutorials for Ruby on Rails.
Books
Programming Ruby - suggested as a great reference for all things ruby.
Visual Basic
Online Tutorials
Found this site which seems to devote itself to visual basic tutorials. Not sure how good they are though.
PHP
Online Tutorials
The main PHP site - A simple tutorial that allows user comments for each page, which I really like.
PHPFreaks Tutorials - Various tutorials of different difficulty lengths.
Quakenet/PHP tutorials - PHP tutorial that will guide you from ground up.
JavaScript
Online Tutorials
Found a decent tutorial here geared toward non-programmers. Found another more advanced one here. Nickolay suggested A reintroduction to javascript as a good read here.
Books
Head first JavaScript
JavaScript: The Good Parts (with a Google Tech Talk video by the author)
C#
Online Tutorials
C# Station Tutorial - Seems to be a decent tutorial that I dug up, but I am not a C# guy.
C# Language Specification - Suggested by tamberg. Not really a tutorial, but a great reference on all the elements of C#
Books
C# to the point - suggested by tamberg as a short text that explains the language in amazing depth
ocaml
Books
nlucaroni suggested the following:
OCaml for Scientists
Introduction to ocaml
Using Understand and unraveling ocaml: practice to theory and vice versa
Developing Applications using Ocaml - O'Reilly
The Objective Caml System - Official Manua
Haskell
Online Tutorials
nlucaroni suggested the following:
Explore functional programming with Haskell
Books
Real World Haskell
Total Functional Programming
LISP/Scheme
Books
wfarr suggested the following:
The Little Schemer - Introduction to Scheme and functional programming in general
The Seasoned Schemer - Followup to Little Schemer.
Structure and Interpretation of Computer Programs - The definitive book on Lisp (also available online).
Practical Common Lisp - A good introduction to Lisp with several examples of practical use.
On Lisp - Advanced Topics in Lisp
How to Design Programs - An Introduction to Computing and Programming
Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp - an approach to high quality Lisp programming
What about you guys? Am I totally off on some of there? Did I leave out your favorite language? I will take the best comments and modify the question with the suggestions.
I know this is going to seem old-fashioned, but I don't think much of using online tutorials to learn programming languages or platforms. These generally give you no more than a little taste of the language. To really learn a language, you need the equivalent of a "book", and in many cases, this means a real dead-tree book.
If you want to learn C, read K&R. If you want to learn C++, read Stroustrup. If you want to learn Lisp/Scheme, read SICP. Etc.
If you're not willing to spend more than $30 and a few hours to learn a language, you probably aren't going to learn it.
These are all really good, written by academia and (some) are books (an unpublished oreilly book --translated from French, but no issues I've found), for example). I've *'d my favorite ones that helped me the most.
ocaml :
*Introduction to ocaml
Using Understand and unraveling ocaml: practice to theory and vice versa
*Developing Applications using Ocaml - O'Reilly
The Objective Caml System - Official Manual
A Concise Introduction to Objective Caml
Practical Ocaml
Haskell :
Explore functional programming with Haskell
*Real World Haskell
*Total Functional Programming
For C#:
CLR via C#
C# in Depth
For C++, I suggest Accelerated C++ by Koenig and Moo as a beginning text, though I don't know how it would be for an absolute novice. It focuses on using the STL right away, which makes getting things done much easier.
Haskell:
O'Reilly Book:
Real World Haskell, a great tutorial-oriented book on Haskell, available online and in print.
My favorite general, less academic online tutorials:
The Haskell wikibook which contains all of the excellent Yet Another Haskell Tutorial. (This tutorial helps with specifics of setting up a Haskell distro and running example programs, for example.)
Learn you a Haskell for Great Good, in the spirit of Why's Poignant Guide to Ruby but more to the point.
Write yourself a Scheme in 48 hours. Get your hands dirty learning Haskell with a real project.
Books on Functional Programming with Haskell:
Lambda calculus, combinators, more theoretical, but in a very down to earth manner: Davie's Introduction to Functional Programming Systems Using Haskell
Laziness and program correctness, thinking functionally: Bird's Introduction to Functional Programming Using Haskell
Effective Java is a must but I recommend being comfortable with Java first to fully understand the examples.
Ruby
The Free Ruby on Rails Training Online Course by Sang Shin Isn't too bad. It also has a decent amount of further reading links on each subject in the course
I'd add Bruce Eckel's programming books:
Thinking in Java (print version: 4th edition; 3rd. ed. is online: http://www.mindview.net/Books/TIJ/)
Thinking in C++ (2nd ed, freely available online: http://mindview.net/Books/TICPP/ThinkingInCPP2e.html
In general, his "Books" page (http://mindview.net/Books/) is a good resource. The freely availabe books can also be found at http://www.ibiblio.org/pub/docs/books/eckel/
Can't believe nobody has mentioned the Perl Best Practices. There's also a Twitter feed that delivers one PBP per day.
I learned Perl from Robert's Perl Tutorial, which I recommend, but it hasn't been updated since 1999. A newer recommended tutorial is Steve's Perl Tutorial.
For web development with Perl, the clear winner is Catalyst, and the Catalyst wiki is the starting point for learning.
For Lisp and Scheme (hell, functional programming in general), there are few things that provide a more solid foundation than The Little Schemer and The Seasoned Schemer. Both provide a very simple and intuitive introduction to both Scheme and functional programming that proves far simpler for new students or hobbyists than any of the typical volumes that rub off like a nonfiction rendition of War & Peace.
Once they've moved beyond the Schemer series, SICP and On Lisp are both fantastic choices.
check out the programming section of wikibooks
Many of them are fully formed, and quite a few have more advanced sections (which are in varying states of completion) on specific functionality.
also, w3 schools has a great php tutorial and reference section
their html and css sections are good for reference too.
C++
Thinking in C++ by Bruce Eckel
C++ Coding Standards by Herb Sutter & Andrei Alexandrescu
The first one is good for beginners and the second one requires more advanced level in C++.
C - The C Programming Language - Obviously I had to reference K&R, one of the best programming books out there full stop.
C++ - Accelerated C++ - This clear, well written introduction to C++ goes straight to using the STL and gives nice, clear, practical examples. Lives up to its name.
C# - Pro C# 2008 and the .NET 3.5 Platform - Bit of a mouthful but wonderfully written and huge depth.
F# - Expert F# - Designed to take experienced programmers from zero to expert in F#. Very well written, one of the author's invented F# so you can't go far wrong!
Scheme - The Little Schemer - Really unique approach to teaching a programming language done really well.
Ruby - Programming Ruby - Affectionately known as the 'pick axe' book, this is THE defacto introduction to Ruby. Very well written, clear and detailed.
For Javascript:
Javascript: The Definitive Guide
Pro Javascript Techniques
For PHP:
PHP Objects, Patterns, and Practice
For OO design & programming, patterns:
Object-Oriented Software Construction (a bible, maybe the Head First OO would be nice, I don't know it)
Head First Design Patterns (I so love this book)
Design Patterns
For Refactoring:
Refactoring: Improving the Design of Existing Code
Working Effectively with Legacy Code
For SQL/MySQL:
Joe Celko: Tree and Hierarchies in SQL (only on a specific subject, but I found it interesting)
Pro MySQL
C Primer Plus, 5th Edition - The C book to get if you're learning C without any prior programming experience. It's a personal favorite of mine as I learned to program from this book. It has all the qualities a beginner friendly book should have:
Doesn't assume any prior exposure to programming
Enjoyable to read (without becoming annoying like For Dummies /
Doesn't oversimplify
Let's not forget Head First Java, which could be considered the essential first step in this language or maybe the step after the online tutorials by Sun. It's great for the purpose of grasping the language concisely, while adding a bit of fun, serving as a stepping stone for the more in-depth books already mentioned.
Sedgewick offers great series on Algorithms which are a must-have if you find Knuth's books to be too in-depth. Knuth aside, Sedgewick brings a solid approach to the field and he offers his books in C, C++ and Java. The C++ books could be used backwardly on C since he doesn't make a very large distinction between the two languages in his presentation.
Whenever I'm working on C, C:A Reference Manual, by Harbison and Steele, goes with me everywhere. It's concise and efficient while being extremely thorough making it priceless(to me anyways).
Languages aside, and if this thread is to become a go-to for references in which I think it's heading that way due to the number of solid contributions, please include Mastering Regular Expressions, for reasons I think most of us are aware of... some would also say that regex can be considered a language in its own right. Further, its usefulness in a wide array of languages makes it invaluable.
Common Lisp
For a good reference of CL check out Common Lisp the Language, 2nd Edition
For Objective C:
Cocoa Programming for Mac OSX - Third Edition
Aaron Hillegass
Published by Addison Wesley
Programming in Objective C,
Stephen G Kochan,
Head First Javascript is a good intro to JS for beginning programmers - it creatively explains basic programming concepts using JS syntax. The Head First series is based on researched techniques for helping you learn and remember new information. They have you do a lot of exercises and puzzles which might seem juvenile, but really help cement the knowledge in your brain.
One exercise I really liked was after they explained data types, they show a picture of a city street and say "label all the data types you can find in this picture." So the blinker on a car is a boolean, the sign on the store is a string, and the address is a number. That helped me get the idea of how to translate real information into a program.
Based only on this book, I'd say the Head First series is a great way to learn something the first time, but the story-like format they have would make them difficult to use as references.
The Ruby Way by Hal Fulton
The Ruby Way cover http://rubyhacker.com/trw2cover.gif
Python: http://diveintopython.net/
JS: a re-introduction to JavaScript is the introduction to the language (not the browser specifics) for programmers. Don't know a good tutorial on JS in browser.
Great idea by the way!
Given recent developments I think it's important to include the recent explosion of free online course offerings from universities and private companies. The new boston is a tutorial site i've always used for numerous languages for years, great beginner point.
http://www.udacity.com/
https://www.coursera.org/
http://www.coursehero.org/
http://www.codecademy.com/
http://mitx.mit.edu/
http://www.khanacademy.org/
http://thenewboston.org/
I second Kristopher's recommendation of K&R for C.
I've found the "Essential Actionscript 2.0" book quite useful for AS coding (there's an AS3 version out now I believe).
I've found that having real books to thumb through is more helpful than an online reference in some cases. Not really sure why though.
hmm, I don't know if I would say that online materials are useless, but I do agree that there is something about books. Maybe they are better written, or maybe it is the act of forking over $50 that makes you more inclined to study the material.
Either way, I agree that books should be part of this question. If anyone has any suggestions for books for languages I will edit the post with the best suggestions.
The reference you have listed for Ruby is for Ruby on Rails. While still ruby deep down, it is definitely not a place to start for people wanting to learn Ruby.
For Ruby tutorials, I would suggest Why's (Poignant) Guide to Ruby as a great starting point for anyone interested in the language.
If you would want to get into more detail, I would recommend the book Programming Ruby, which has become the standard for all things Ruby. The third edition is currently being written, highlighting Ruby 1.9 features, so I would hold off for a while if anyone is considering buying this book.
For J2EE you have a very comprehensive tutorial at:
http://java.sun.com/javaee/5/docs/tutorial/doc/
For Java, I highly recommend Core Java. It's a large tome (or two large tomes), but I've found it to be one of the best references on Java I've read.
I know this is a cross post from here... but, I think one of the best Java books is Java Concurrency in Practice by Brian Goetz. A rather advanced book - but, it will wear well on your concurrent code and Java development in general.
The defacto standard for learning Grails is the excellent Getting Started with Grails by Jason Rudolph. You can debate whether it is an online tutorial or a book since it can be purchased but is available as a free download. There are more "real" books being published and I recommend Beginning Groovy and Grails.
C#
C# to the Point by Hanspeter Mössenböck. On a mere 200 pages he explains C# in astonishing depth, focusing on underlying concepts and concise examples rather than hand waving and Visual Studio screenshots.
For additional information on specific language features, check the C# language specification ECMA-334.
Framework Design Guidelines, a book by Krzysztof Cwalina and Brad Abrams from Microsoft, provides further insight into the main design decisions behind the .NET library.