Language page — context, influences, and learning notes on the 100hellos site.
Source on GitHub (100hellos/snobol4)
docker run --rm --platform="linux/amd64" 100hellos/snobol4:latest
Read the repo README, or fork the project and customize it.
For an interactive shell:
docker run --rm --platform="linux/amd64" --entrypoint="" -it 100hellos/snobol4:latest zsh
SNOBOL4 (StriNg Oriented and symBOlic Language) is a high-level programming language developed at Bell Labs in the 1960s by David J. Farber, Ralph E. Griswold, and Ivan P. Polonsky. It is particularly renowned for its powerful string processing and pattern matching capabilities.
* SNOBOL4 Hello World - Demonstrating Language Features
GREETING = "Hello"
TARGET = "World"
PUNCTUATION = "!"
* Use pattern matching to build message
MESSAGE = GREETING " " TARGET PUNCTUATION
* Demonstrate pattern replacement
MESSAGE "World" = "wonderful World"
MESSAGE "wonderful " = ""
* Show conditional pattern matching with success/failure
MESSAGE "Hello" = "Hello" :S(FOUND) F(NOTFOUND)
FOUND OUTPUT = MESSAGE
:(END)
NOTFOUND OUTPUT = "Pattern not found"
END
The program demonstrates several key SNOBOL4 features:
* in column 1 are commentsGREETING " " TARGET)MESSAGE "World" = "wonderful World" finds "World" and replaces it:S(FOUND) F(NOTFOUND) branches based on pattern match successFOUND and NOTFOUND are labels for program flow control:(END) jumps to the END labelSNOBOL4 was groundbreaking for its time and influenced many later languages:
SNOBOL4's pattern matching goes far beyond regular expressions. It can match nested structures, perform arithmetic during matching, and even modify patterns dynamically during execution. This makes it particularly suitable for parsing complex text formats, language processing, and symbolic computation.
This container uses CSNOBOL4, a modern C implementation that maintains compatibility with the original Bell Labs SNOBOL4 while adding portability to modern operating systems.
Content type
Image
Digest
sha256:727030d1f…
Size
113.5 MB
Last updated
4 months ago
docker pull 100hellos/snobol4