Tiny-C Reference Manual Excerpt

surprisetalk1 pts0 comments

tiny-c Reference Manual Excerpt – The People's Permacomputer Project

Skip to content

tiny-c Reference Manual Excerpt

Written by

vidak

in

Archeology

The project found this little manual instructive. You could say it is a kind of C flavour that is inspired by BASIC!

https://archive.org/details/tiny-c_manual

Preface

The sources of ideas that went into tiny-c are many. First there is BASIC [Kemeny & Kurtz 1967]. BASIC has become the de facto standard training language in the United States. It industry, is popular in high schools, universities, even in where it is used for some production work. Although BASIC has its faults, its one big strength is that it is easy to learn. This is largely because it offers a single computing environment. You can enter new program lines, change old ones, and start a program running all from one command environment. You do not have to remember the environment you are in, i.e., you edit mode, compile mode, link mode, system mode, run mode, etc., when giving a command. There are no commands to shift from mode to mode. There no relocatable object modules, link editors, and all the other paraphernalia of “real” computers. Is is very simple and very adequate. Thus a focus is made on the essential elements of computing, as opposed to the elements of “wrestling” with a computer.

The LOGO language [Feurzeig 1975] is in many ways similar to tiny-c. It offers a well-structured language based on BASIC, as well as a single environment for programming and execution. LOGO was used experimentally in public schools with very young children. The experiment showed that children could grasp simple computer concepts and work through a prepared set of exercises, and then do creative work of their own.

C [Ritchie, Kernighan, & Lesk 1975] is a computer language designed by Dennis Ritchie, at Bell Telephone Laboratories, tiny-c borrows its overall structure from C. C is broadly used in universities and in industry. It has been used to program a very advanced and powerful computer operating system, called UNIX [Ritchie & Thompson 1974]. At yet it is a very simple language. C has no native input/output, e.g., read or print statements. Input/output is done using functions. Thus C concentrates on COMPUTING facilities, and allows external development or elaborations of input/output. tiny-c has adopted this idea.

The command environment for tiny-c is written in tiny-c. It needs no translation to the micro-processor’s machine language. This corresponds somewhat to the idea of using C as the programming language to implement UNIX. So, although intended as a training language for structured programming, tiny-c is a powerful language.

The tiny-c OWNER’S MANUAL is trying to reach four audiences at the same time. For those new to structured programming we have a brief tutorial and program walk-through so they can get the gist of it without getting bogged down in details. Experienced users of structured programming will find that the references sections let them quickly discover the features of tiny-c. For those who want to know how the tiny-c interpreter works, we have described its operation. And, finally, for those who want to install tiny-c on their home computer, we have included a complete installation guide.

Introduction

What is tiny-c? tiny-c is

a language, plus

a standard library, plus

a program preparation system.

Without any other software aids, you can prepare tiny-c programs, run them, edit them, store them on a cassette or floppy disk, and read them back later.

tiny-c is a structured programming language which has if-then-else, while-loops, functions, global and local variables, and character and integer data types, pointers, and arrays.

tiny-c is independent of operating systems. You can interface it easily to the input/output routines on your computer.

tiny-c can invoke your own machine language subroutines so the tiny-c programming language can be fitted to your system and your system can be reflected in and extend the language.

A tiny-c Program Walk-Through

Figure 1-1 is a complete tiny-c program consisting of two functions.

FIGURE 1-1

/* guess a number between 1 and 100<br>/* T. A. Gibson, 11/29/76

guessnum [<br>int guess, number<br>number = random (1,100)<br>pl "guess a number between 1 and 100"<br>pl "type in your guess now"<br>while (guess != number) [<br>guess = gn<br>if (guess == number) pl "right !!"<br>if (guess > number) pl "too high"<br>if (guess

End of FIGURE 1-1

How does this program work? Let’s do a program walk-through:

Starting at the top, the first two lines are COMMENTS. A comment start with /* and goes to the end of the line.

“guessnum” is the name of a FUNCTION which is called to start the program.

Following “guessnum” is a COMPOUND STATEMENT, which is 12 lines long, the last line being:

] /* end of program

A compound statement is everything between balanced left-right brackets.

The first SIMPLE STATEMENT in guessnum is:

int guess, number

This declares two INTEGER...

tiny language program guess number mode

Related Articles