ALGOL
1958fraglethistoricalimperativestructured.alg
docker run --rm --platform="linux/amd64" 100hellos/algol:latest
MCP + fragletc
MCPstdin
This language supports code execution via MCP and the fragletc CLI. Stdin piping is supported.
Install fragletc →Algorigthmic Language (ALGOL) is a family of imperative computer programming languages originally developed in the mid-1950s. It introduced code blocks and the begin...end pairs for delimiting them.
This is container has an implementation of ALGOL 60 from JvanKatwijk that converts Algol 60 to C, and then builds the C program. Your milage may vary with this implementation, but we're lucky it exists at all!
Hello World
begin
outstring (1, "Hello World!\n");
end;Coding Guide
Code format
- Full block. Your fragment is a complete
begin…end;block. You can write any number of declarations and statements.
Minimal fragment (copy and adapt)
begin
outstring (1, "Hello from fragment!\n");
end;Language / runtime
- ALGOL 60 via jff-algol (Algol 60 → C translator, then compile and run).
- Channel 0 = standard input; channel 1 = standard output.
Output and input (prelude procedures)
- outstring (1, "text"); — print string to stdout.
- outinteger (1, n); — print integer.
- outreal (1, x); — print real.
- newline (1); — newline.
- space (1); — space.
- ininteger (0, n); — read one integer from stdin (channel 0) into variable
n; must be declared integer. - inreal (0, x); — read one real from stdin into variable
x.
Variables used with ininteger/inreal must be declared (e.g. integer n; or real x;) and passed by value in the prelude sense (the procedure assigns into them).
Common patterns
- Print:
begin/outstring (1, "message\n");/end; - Declare and print:
begin/integer n; n := 42; outinteger (1, n); newline (1);/end; - Read and echo:
begin/integer n; ininteger(0, n); outinteger(1, n); newline(1);/end; - Arithmetic: use
+,-,*,/; assign with:=.
Caveats
- Stdin works when piping input. The generated C program has no
argc/argvexposure; command-line arguments are not available from ALGOL. - Statements end with
;. Variable names and keywords are case-insensitive in ALGOL 60; jff-algol follows that.
Fraglet Scripts
Stdin Int
#!/usr/bin/env -S fragletc --vein=algol
begin
integer n;
ininteger(0, n);
outinteger(1, n);
newline(1);
end;Stdin Upper
#!/usr/bin/env -S fragletc --vein=algol
begin
integer n;
ininteger(0, n);
outinteger(1, n);
newline(1);
end;Test
#!/usr/bin/env -S fragletc --vein=algol
begin
outstring (1, "Hello World!\n");
end;