📰 newsreader

hackernews score 1.17 好み 0.38 en

T3X/0:最小限の手続き型言語

原題: T3X/0 a Minimal Procedural Language

t3x/0programming languageprocedural languagecompilercp/mtcode virtual machineself-hostingcross-compilation
原文 ↗

日本語訳

# タイトル

T3X/0:最小限の手続き型言語

# 本文

T3X/0

最小限の手続き型言語

[ ダウンロード | 書籍 | リファレンス ]

T3X/0は、小型でポータブル、手続き型、ブロック構造、再帰的、そしてほぼ型を持たないプログラミング言語であり、T3X言語ファミリーの最新メンバーです。コンパイラは自由に使用可能です(0BSDライセンスまたはパブリックドメイン)。T3X/0の構文はPascalに似ており、その意味論はBCPLに似ています。こちらにT3X/0言語のチートシート(PDF)があります。

T3X/0パッケージには、コンパイラ機能が組み込まれた2つのエディタ(VI互換とWordStar互換)が含まれています。わずか3つのキーを押すだけで、プログラムをコンパイルできます。エラーが発生した場合、エディタはその箇所までジャンプします。これはCP/M上でも動作します!

T3X/0は、以下の書籍で学習用言語として使用されています。

- Write Your Own Retro Compiler

- Write Your Own Programs

本書『The T3X Programming Language - Formal Definition』において、形式的に定義されています。

以下は、T3X/0における最もシンプルな「Hello World」プログラムです。

USE t3x: t;

DO t.write(T3X.SYSOUT, "Hello, World!\r\n", 15); END

(もちろん、このプログラムは一部を簡略化しています。より正確なバージョンは以下の通りです。)

以下は、T3X/0で書かれたより興味深いプログラムです。

- シンプルな例

- より(あるいは、より少なく)本格的なプログラム

T3X/0言語について詳しく知りたい場合は、こちらを参照してください。

- T3X/0の非常に短い要約

- T3X/0言語リファレンス

- T3X/0オンラインコンパイラ

T3X/0は現在、以下の環境で動作します。

- Unix (386, x86_64, ARMv6, ARMv7)

- FreeBSD-386 (静的コードバックエンド、LIBC不要)

- macOS-686

- {PC, MS, DR, etc}-DOS 2.0以降

- CP/M 2.2 (Z80のみ)

- TCVM (Tcode Virtual Machine)

すべてのサポートされているプラットフォームでセルフホスティングが可能であり、すべてのサポートされている16ビットプラットフォームへのクロスコンパイルも可能です。

- サポートされているシステムに関する詳細

- コンパイラの統計情報

コンパイラのダウンロード

- t3x0-47.zip (現行バージョン、約350KB)

これは、コンパイラ(T3X/0で記述)とランタイムライブラリ(Z80、8086、386のアセンブリ言語、およびCで記述)の完全なソースコードです。アーカイブには、C言語によるTcode仮想マシン(TCVM)の実装、DOS用のTCVMバイナリ、追加のライブラリ、サンプルプログラム、コンパイラ機能内蔵のエディタ(「IDE」)2種、ドキュメント、およびCP/M、DOS、FreeBSD、Tcodeマシン用のプリコンパイル済みコンパイラバイナリも含まれています。書籍版からの変更点は?

- t3x0-12.zip (書籍版、約200KB)

上記と同様ですが、書籍が発行された時点のバージョンで固定されています。

- t3x0dos.zip (DOS用バイナリ、約100KB)

DOS用のプリコンパイル済みT3X/0コンパイラです。DOSテキスト形式の全ライブラリ、T3X/0リファレンスマニュアル、サンプルプログラム、NOEおよびVEEエディタ(ソースコードを含む)、および任意のディレクトリにインストールできるようコンパイラをパッチするための設定ユーティリティが含まれています。

- t3x0cpm.zip (CP/M用バイナリ、約310KB)

CP/M用のプリコンパイル済みT3X/0コンパイラです。CP/Mテキスト形式の全ライブラリ、T3X/0リファレンスマニュアル、サンプルプログラム、NOEおよびVEEエディタ(ソースコードを含む)、および任意のディスクドライブにインストールできるようコンパイラをパッチするためのユーティリティが含まれています。

注意:CP/Mにはディレクトリが存在しないため、ZIPファイルはカレントディレクトリに展開されます。ZIPファイルは無圧縮であるため、CP/M上で展開可能です。

- t3x0agon.zip (Agon Light 2用CP/Mディスクイメージ、約110KB)

上記のt3x0cpm.zipの全ファイルを含む8MBのCP/Mハードディスクイメージです。CP/Mを実行しているAgon Light 2コンピュータへのインストールを想定しています。

原文(英語)を表示

T3X/0

A Minimal Procedural Language

[ Download | Book | Reference ]

T3X/0 is a small, portable, procedural, block-structured, recursive,

and almost typeless programming language, and the latest member of

the T3X family of languages. Its compiler is freely available

(0BSD license or public domain). T3X/0 syntax is similar to Pascal,

its semantics resembles BCPL's. Here is a

T3X/0 language cheat sheet (PDF).

The T3X/0 package provides two editors (one VI-compatible, one

WordStar-compatible) with built-in compiler support. Compile your

programs by literally pressing three keys. In case of an error the

editors jump to the error. This works even on CP/M!

T3X/0 is used as a teaching language in the books

-

Write Your Own Retro Compiler and

-

Write Your Own Programs

It is formally defined in the book

The T3X Programming Language - Formal Definition.

Here is the simplest "Hello World" program in T3X/0:

USE t3x: t;

DO t.write(T3X.SYSOUT, "Hello, World!\r\n", 15); END

(Of course this program cuts some corners, so here are some

more correct versions.)

Here are some more interesting programs written in T3X/0:

-

Simple Examples

-

More (or Less) Serious Programs

If you want to learn more about the T3X/0 language, here is

-

A Very Short T3X/0 Summary

-

The T3X/0 Language Reference

-

A T3X/0 online compiler

T3X/0 currently runs on

- Unix (386, x86_64, ARMv6, ARMv7)

- FreeBSD-386 (static code backend, LIBC not needed)

- macOS-686

- {PC,MS,DR,etc}-DOS 2.0 and later

- CP/M 2.2 (Z80 only)

- The TCVM (Tcode Virtual Machine)

It is self-hosting on all supported platforms and can cross-compile

to all supported 16-bit platforms.

-

More details on supported systems

-

Some compiler statistics

Download the Compiler

- t3x0-47.zip (current version, ~350KB)

-

This is the full source code to the compiler (in T3X/0) and the

runtime libraries (in Z80, 8086, and 386 assembly language, and in

C). The archive also contains an implementation of the Tcode Virtual

Machine in C, a TCVM binary for DOS, additional libraries, example

programs, two editors with built-in compiler support ("IDEs"),

documentation, and pre-compiled compiler binaries for CP/M, DOS,

FreeBSD, and the Tcode machine. What's new since the book version?

- t3x0-12.zip (book version, ~200KB)

-

This is the same as above, but the version frozen at the time when

the book was published.

- t3x0dos.zip (DOS binaries, ~100KB)

-

A pre-compiled T3X/0 compiler for DOS, including all libraries in

DOS text format, the T3X/0 Reference Manual, example programs, the

NOE and VEE editors (including their source code), and a configuration

utility for patching the compiler so that it can be installed in a

directory of your choice.

- t3x0cpm.zip (CP/M binaries, ~310KB)

-

A pre-compiled T3X/0 compiler for CP/M, including all libraries in

CP/M text format, the T3X/0 Reference Manual, example programs, the

NOE and VEE editors (including their source code), and a utility

for patching the compiler so that it can be installed on a disk

drive of your choice.

Warning: ZIP file extracts into the working

directory, because CP/M has no directories. The ZIP file is

uncompressed, so it

should extract under CP/M.

- t3x0agon.zip (CP/M disk image for the Agon Light 2, ~110KB)

-

An 8MB CP/M hard disk image containing all files of t3x0cpm.zip,

above. Intended to be installed on an Agon Light 2 computer

running CP/M.

← 一覧に戻る