Hello world in every programming language
github.com
github.com
Hello World
The one they have with <?php print("Hello World"); ?> is also an opcode longer than using <?php echo "Hello World"; ?> because off the FREE on the return value from the print. But a file just containing the string: Hello World and nothing else will generate the same opcodes as the echo version so they are equivalent and you might as well use the shorter form. A file without an opening <?php tag is still a perfectly valid PHP program.
But one way that is easier than diving into the source code is to just dump the opcodes using vld (see pecl.vld). I have a little wrapper shell script /usr/local/bin/vld:
#!/bin/sh -e
exec php -dvld.active=1 -d vld.execute=0 "$@"
Then for the hello world program with the print() call: % vld hello1.php
Finding entry points
Branch analysis from position: 0
Return found
filename: /tmp/hello1.php
function name: (null)
number of ops: 3
compiled vars: none
line # * op fetch ext return operands
---------------------------------------------------------------------------------
2 0 > PRINT ~0 'Hello+World'
1 FREE ~0
4 2 > RETURN 1
branch: # 0; line: 2- 4; sop: 0; eop: 2
path #1: 0,
vs. the one that just contains the string: Hello World % vld hello2.php
Finding entry points
Branch analysis from position: 0
Return found
filename: /tmp/hello2.php
function name: (null)
number of ops: 2
compiled vars: none
line # * op fetch ext return operands
---------------------------------------------------------------------------------
2 0 > ECHO 'Hello+World%0A'
1 > RETURN 1
branch: # 0; line: 2- 2; sop: 0; eop: 1
path #1: 0,It's a little more involved than a Hello World in that it needs to handle input, output, state etc.
I could always use more languages if anybody wants to pitch in.
This isn't to confuse Morse code with reMorse : http://esolangs.org/wiki/ReMorse
The site does have one filed only under 'javascript' implemented with alert(), but that's really javascript as it exists in browsers.
I don't think whether IO is built into a language is really the important question. If people are interested in seeing how IO works with different frameworks, those examples should be there. But if people just want to see what a language's basic syntax looks like, not the specifics of emitting IO in various frameworks, there should be one example per language, even for languages which lack built-in IO.
https://github.com/leachim6/hello-world/blob/master/m/malbol...
I wonder if it was written by hand; that would be impressive. Doesn't look like it would be too hard to hand roll a little compiler for it.
And if I recall correctly, it took years to do.
Edit: Grr it is missing one of my favorite JVM.next() languages of the week Kotlin, I will have to update it.
w "Hello World",!
but if you write controlled, sensible code, then it's actually not. certainly never my language of choice but it it's not just still used due to inertia... it's pretty fast, it makes database interaction easy, it's pretty easy to understand if the code isn't doing something awful like assuming variables and relying on hidden state. (which you can do, yes.)
if you're talking about the Daily WTF articles, then no it's not nearly as bad as those articles would imply. I worked for a company that is probably featured in one, but not all, of those articles... we had good tools, good coding standards/dev process, a good internal API/libraries that do quite a lot, and sensible people. Under these circumstances it was not bad--I'd actually grown quite fond of it. (No codebase of a large old company will be WTF-free but this isn't language-specific. I don't think any actual code from those Daily WTF articles actually comes from that company...)
Also, "A Case of the MUMPS" gets many things wrong.
'Scope of IF and FOR is "remainder of current line."' Nope. That's what 'do' is for. Note that ';' comments out everything to the right on the same line.
for i=1:1:100 do ; equivalent to 'for(int i=1;i<101; i++) { }', with the lines below indented with a period serving as the body of the brackets
. write !,"line 1 of code block, iteration "_i
. write !,"line 2 of code block, iteration "_i
. write !,"line 3 of code block, iteration "_i
write !,"Done with loop" ; this gets executed after the for loop
Note that I'd actually write this as 'f i=1:1:100 d' and 'w "string"' in place of "for i=1:1:100 do" and 'write "string"'. It's just as easy to read if you know the language, especially if you have nice syntax highlighting, and easier to write. Which brings me to...'To edit the code stored in the “database”, developers needed to use the internally-created text editor.'
Not in our case, and this makes me wonder how long ago this guy's experience was. in our case, the vendor provided an IDE and we also had our own, written in C#, which is actually my favorite IDE from any language.
You want to do FizzBuzz? I present the shortest FizzBuzz in almost any language other than APL or Perl:
f i=1:1:100 w ! w:'(i#3) "Fizz" w:'(i#5) "Buzz" w:'$x i
Or, in pseudocode: for i=1:1:100
print "\n"
if not (i%3) print "Fizz"
if not (i%5) print "Buzz"
if not x_pos_of_cursor print i
Ah, yes, and don't ever use dot notation as above if you plan on wanting comments on your line, i.e. for
. blah
; some comment here
. foo
foo here won't execute. Instead this works: for
. blah
. ; some comment here
. foo
Tripped me up the first time I dealt with that... however, these days with Caché ObjectScript (the most popular MUMPS dialect) it'd be written: for {
blah
// some comment here
foo
}It even has BCPL and LabVIEW!
i.e.: i'm one of the most senior ACT3 programmers worldwide. (well, there were only about a dozen or so people) it was a programming language used extensively at the national austria press agency. it was - at it's time (around 2001) - for more advanced as PHP 4. the hello world would have looked something like this
<!--%'hello world'-->
(the <!-- --> was a relict from ACT2 ...)
yes it was an abomination, but it worked, and it was fast.
ok, anyway, ARC is missing, too. I think the claim "every programming language" is a) wrong and b) not really feasible.
Submit a pull request for ACT3 and you'll have one less language's absence to notice.
The point I'm trying to make is: "Every programming language" will always be wrong.
does anyone know how many company/cooperation internal programming language are supposed to exist? is there even a way to estimate it?
/Times-Roman findfont 12 scalefont newpath 200 200 moveto (Hello World) show closepath Showpage
Use this in gs on Linux or y gswin32 on windows
Update:
And I don't see Processing either
10 PRINT "Hello World"
printfn "Hello World"
I'm not going to submit a pull request, fortunately I've never had to write anything in that language.