Smalltalk Hello World Example: How To Write and Execute Smalltalk Program on Linux OS

by Ramesh Natarajan on October 23, 2009

Question: I would like to understand the basics of how to write and execute a small talk program on Linux OS. Can you explain it with a simple example?

Answer: In this article, let us review very quickly how to write a basic Hello World SmallTalk program and execute *.st program on Linux or Unix OS.

1. Write a Hello World SmallTalk Program

Create the helloworld.st program using the Vim editor as shown below.

$ vim helloworld.st

"Hello world Program"

'Hello World!' printNl !

2. Make sure gst (GNU Smalltalk) is installed on your system

Make sure gst is installed on your system as shown below.

$ whereis gst
gst: /usr/bin/gst /usr/include/gst.h /usr/share/man/man1/gst.1.gz

$ which gst
/usr/bin/gst

Installing GNU Smalltalk virtual machine.

If you don’t have smalltalk virtual machine, install it as shown below.

$ sudo apt-get install gnu-smalltalk

3. Execute the small talk program.

$ gst helloworld.st
Hello World!

4. Smalltalk interactive mode

You can also execute smalltalk commands interactively in the smalltalk shell as shown below.

$ gst -q
GNU Smalltalk ready

st> 'Hello World!' printNl !
'Hello World!'
st>
Download Free eBook - Linux 101 Hacks

Get free Unix tutorials, tips and tricks straight to your email in-box.

If you enjoyed this article, you might also like..

  1. Lua Hello World Example: How To Write and Execute Lua Program on Linux OS
  2. Ruby Hello World Example: How To Write and Execute Ruby Program on Unix OS
  3. Fortran Hello World Example: How To Write and Execute Fortran Program on Linux OS
  4. Cobol Hello World Example: How To Write, Compile and Execute Cobol Program on Linux OS
  5. Pascal Hello World Example: How To Write, Compile and Execute Pascal Program on Unix OS
  

Vim 101 Hacks Book

Leave a Comment

Previous post:

Next post: