This was just a fun exercise for the remembrance of all the cool programming languages that have been developed and will be developed. Thank you for all these wonderful languages! I met some of the awesome programming languages designers and was always quite impressed. It is one of the most difficult endeavors to create and evolve a language. I originally had focussed on compiler construction and AI in the late 1970s and 1980s during school and university. My first programming language has been TRS 80 Basic (obviously a sibling of Microsoft‘s MS Basic).
Note: I know there are websites where similar examples are listed, but I wanted to „feel“ the code myself.
Here is the famous, ubiquitous, unique, truly awesome “Hello, World!” in a wide variety of programming languages.
Consider it as kind of Programming Language Museum:
-- Ada
with Ada.Text_IO; use Ada.Text_IO;procedure Hello is
begin
Put_Line ("Hello, World!");
end Hello;
* SAP ABAP
REPORT ZHELLO_WORLD.
WRITE: / 'Hello, World!'.
/* B */
main() {
printf("hello, world");
}
# Befunge-93
> v
v ,,,,,"Hello"<
>48*, v
v,,,,,,"World!"<
>25*,@
/* C */
// C++
// CUDA (C++ with NVIDIA extensions)
// D
; Clojure
# Crystal
// Groovy
// Java
# Julia
(* OCaml *)
# Python
// JavaScript (Node.js)
// TypeScript
# Ruby
// Go
// Rust
// C#
// V
// Haxe
# GolfScript
# Malbolge
# Ook!
# Piet
// Swift
// Kotlin
<?php
# Perl
#!/bin/bash
# PowerShell
-- Haskell
// Scala
-- Lua
# Underload
# R
// Zig
% MATLAB / Octave
// Dart
# Elixir
% Erlang
/* Ceylon */
;; Common Lisp
;; Scheme
(* Standard ML *)
# Nim
% Prolog
// F#
' VB.NET
// Objective‑C
-- SQL
-- Eiffel
-- Elm
<!DOCTYPE html>
// Verilog
@ ARM Assembly (Linux syscall)
# RISC-V Assembly (Linux syscall)
# MIPS Assembly (Linux syscall)
; x86 Assembly (NASM/Linux)
*> COBOL
IDENTIFICATION DIVISION.
PROGRAM‑ID. HELLO.
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
DISPLAY "Hello, World!".
STOP RUN.
C FORTRAN
PROGRAM HELLO
PRINT *, 'Hello, World!'
END
/* PL/1 */
HELLO: PROCEDURE OPTIONS(MAIN);
PUT LIST('Hello, World!');
END HELLO;
\ FORTH
: hello ( -- )
." Hello, World!"
CR
;
hello
)COMMENT APL
⎕←'Hello, World!'
; Logo (UCBLogo)
to helloworld
print [Hello, World!]
end
" Smalltalk (ANSI‑Smalltalk)
Transcript show: 'Hello, World!'; cr.
// Scratch (textual representation of blocks)
// when green flag clicked
say "Hello, World!" for 2 seconds
comment ALGOL 60;
BEGIN
print("Hello, World!");
END
// Pascal
program Hello;
begin
writeln('Hello, World!');
end.
(* Modula-2 *)
MODULE HelloWorld;
IMPORT InOut;
BEGIN
InOut.WriteString("Hello, World!");
InOut.WriteLn;
END HelloWorld.
(* Oberon *)
MODULE HelloWorld;
IMPORT Out;
BEGIN
Out.String("Hello, World!");
Out.Ln;
END HelloWorld.
REM MS BASIC
10 PRINT "Hello, World!"
20 END
REM MS‑DOS Batch
@ECHO OFF
ECHO Hello, World!
PAUSE
# Brainfuck
>++++++++[<+++++++++>-]<.>++++[<+++++++>-]<+.+++++++..+++.>>++++++[<+++++++>-]<++.------------.>++++++[<+++++++++>-]<+.<.
; Turing Machine (Hello, World!)
; Alphabet: { _ (blank), H, e, l, o, ,, (space), W, r, d, ! }
; States: q0…q12, q_accept (halt)
; Format of each transition:
; current_state read_symbol → write_symbol move_direction next_state
q0 _ → H R q1
q1 _ → e R q2
q2 _ → l R q3
q3 _ → l R q4
q4 _ → o R q5
q5 _ → , R q6
q6 _ → R q7 ; space
q7 _ → W R q8
q8 _ → o R q9
q9 _ → r R q10
q10 _ → l R q11
q11 _ → d R q12
q12 _ → ! R q_accept
; final transition to halt (no movement)
q_accept _ → _ N HALT
; Markov algorithm
; Rewrite rules to transform the start symbol “S” into “Hello, World!”; Initial string: S
1. S -> H A
2. A -> e B
3. B -> l C
4. C -> l D
5. D -> o E
6. E -> , F
7. F -> ␣ G ; use “␣” to denote a space
8. G -> W H1
9. H1 -> o I
10. I -> r J
11. J -> l K
12. K -> d L
13. L -> ! M
14. M -> ; rule with empty RHS halts the algorithm
; Explanation of application:
; – Start with “S”
; – Apply rule 1: “S” → “H A”
; – Apply rule 2 on “A”: “H A” → “H e B”
; – …and so on, until rule 14 removes the final marker “M”
; – Resulting string: “Hello, World!”
No comments:
Post a Comment