phreda4.github.io

:r4 web site

View on GitHub

:r4 programing languaje

Source

:r4 is a language derived from ColorForth created in 2005. As all Forth is Minimalist, it does not need complex mechanisms of abstraction, in fact the only mechanism of abstraction is the adress. Forth is not popular these days but curiously does not die, every programmer of forther knows why.

Idea

The idea is simple:

* Any number in source code go to the data stack.
* Any adress of word is stack too.
* Any word (characters separate by spaces) search in dictionary,
  +	If is found execute the word.
  +	Else is an error, stop compilation!!

Unlike ColorForth, the meaning of words is defined by prefixes. the most importan is ‘ (adressof) then word execute a word, and ‘word is the adress of word. This adress is a powerfull abstraction, many languajes try to avoid this, but here we recommend its use.

For make a program you need define yours words to express the algorithm that tries to solve the problem to be programmed.

A program have two types of words, actions and data, time and space. For define an action :r4 use the prefix : and to define data the prefix #

:thiswordisanaction 1 2 3 + * ;

#thisisdata 33

When you define a word, only you can use a word previous defined, or current definition for recursive words.

When start a program, the diccionary have basic definitions:

Main Diccionary

The main diccionary has a basic interaction with the OS, 12 words, very basic. This aproach has some advantages over recreate all the API calls.

The cons is not have full access to hard, for now!, we can modify this in any moment.

Words for SOUND, PRINTER, JOYSTICK and WEB has a definition for particular nedded,but the idea is avoid this and in some point, recreate in :r4, the graphics words are already recreate for the actual compiler.

Keep it simple, this is the main path, but simple is not easy, is a search in the world of problem for extract or ideate a correct and basic solution.

A more advanced introducction

Landscape

More about Registers

Current development

The current development in computers is dominated by certain ideas that in my opinion are wrong.

The idea of using complex structures to simplify development only makes the problem worse. In addition to hiding certain parts of the problem that should be exposed to see the solution correctly.

The idea of defensive programming by calling a lawyer and making it clear that it can be done and not done, even before writing a single calculation, then now instead of having an algorithm, we have an algorithm and a lawyer.

Many good programming practices are wrong, since you try to find a generality in the development and the systems solve a unique problem, not a different set of problems. Charles Moore say, real programs execute in real computers.

Basic Library

Configuration

The Basics

The Main Loop

Strings

Vectors Graphics

Animation

Memory

Fonts

Mprint

GUI

Data Structures

Math

Bitmaps

Icons

3d Math

Debug

Random

Memory Data Base

Basic Shooter

Compiler

The :r4 compiler make two files in r4asm/ folder, code.asm and data.asm and then this is compile when call FASM.

Tokenizer

Post Tokenizer

Generate Code

Profiler Code

Editors

Text Editor

Vector Editor

Bitmap Editor

Icon Editor