The Easy Language
Oct. 8th, 2025 01:00![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Easy Does ItТак вот, один гениальный человек (
or...
A COMPILER FOR AN
ALGEBRAIC LANGUAGE
A compiler is always a large program. To write one from scratch, even in a pedagogical environment, is a major undertaking. Although Easy is designed to reduce the pain while providing as much enlightenment as possible, this still is the hardest problem in the book. Do not tackle it unless you (and some helpful friends) have plenty of time and energy.
THE EASY LANGUAGE
Easy is a general-purpose, procedural, algebraic programming language. Its roots lie in ALGOL, ALGOL 68, and PASCAL. Like them, it is designed to be compiled, loaded, and executed on a reasonably conventional computer (the EC-1 described in Chapter 25 is a good example). The syntax is described by a context-free grammar suitable for parsing by LR(1) techniques. The semantics are similar to the languages described above, and we will let an informal description suffice, trusting to the reader’s skill to fill any gaps. In the text below, logically connected portions of the grammar are described with the associated semantics.
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Пример кода на языке Easy, игра Жизнь: life.easy
Компилируем, запускаем:
Получаем:git clone https://github.com/begoon/easy.git
cd easy
node easyc.ts life.easy
cc life.c -o life -I.
./life
** [ EASY LIFE ] *****************************************************************
* xx *
* xx xx *
* x x xxx *
* xx x xxx *
* x x x xx *
* xx x x x xx *
* xxx x x *
* x xxx xxx *
* xxxxx xx xx *
* xx x x x *
* x x xx *
* x xx *
* xxx *
* x *
* x xx x *
* xxx xxx x x *
* x x x *
* x x xx *
* x x *
* *
* *
* *
* xx *
* xx xx *
* xx *
**********************************************************************************
GENERATION: 104