gnodvi / HET

A very simple language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HET

Build Linux Windows Coverity Coverage Codecov
status Travis CI build status AppVeyor CI build status Coverity Scan Build Status Coverage Status Codecov

HET is a very simple educational programming language dating from 1976 and described in this document, pages 59-78 and in this report.

Overview

HET looks like an imperative version of Joy. The abstract machine that the language implements offers a working stack (WS), a program stack (PS), and memory (MEM). The datatypes of the language are: word, list, and 16 special characters. Whitespace characters are needed to separate words from each other.

Datatypes

The specials are described in the following table. The arity in this table tells how many items are taken from the WS and how many are returned.

Special Arity Description
! 1/0 Move an item from the WS to the PS, unpacking list items.
$ 1/0 Execute a foreign function. Addition
% 2/1 Create a new local name and assign the next item from the WS. Addition
# 0/0 Ignore the rest of the line. Addition
* 1/1 Replace a word on the WS with its definition.
+ 2/1 Add an item to a list.
. 1/0 Print an item from the WS and a newline. Remove the item. Addition
/ 1/2 Divide a non-empty list into rest and first.
: 2/1 Take a word and an item from the WS and store the assignment in MEM.
; 1/0 Remove an item from the WS.
< 1/1 Take a word from the WS and push a list with the characters of the word.
= 2/1 Take the top two items from the WS and push t or f depending on equality.
> 1/1 Take a list of characters from the WS and push the concatenated word.
? 1/1 Take an item from the WS and push its type: w, l, or s.

Changes

The document has up-arrow and down-arrow as specials. These are non-ASCII characters, so I have changed them into * and :. The report has ^ instead of the up-arrow and \ instead of /.

Additions

The document allows debug output, so I am adding ., allowing normal output and making debug output optional; # can be used to comment out the rest of the line; $ adds foreign functions; % adds local definitions.

Installation

There is a bootable floppy-image with the version from the report.

Install and start DOSBox. At the prompt type: boot c:/HET_flop_image or whatever.

Note: The links to the report and the floppy-image are currently dead. They are mentioned here.

The version presented here can be built with these commands:

cmake .
cmake --build .

About

A very simple language

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:C 97.0%Language:CMake 2.0%Language:Shell 1.0%