Skip to content

Commit

Permalink
everything is ready for the release of version 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Centrix14 committed Dec 31, 2019
1 parent e18daf0 commit cf4ec67
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 6 deletions.
4 changes: 0 additions & 4 deletions .gitignore

This file was deleted.

2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ saol:
gcc -o saol saol.c unitok/unitok.c arr_lib.c
isi:
gcc -o isi isi.c unitok/unitok.c arr_lib.c
ssp:
gcc -o ssp ssp.c unitok/unitok.c
77 changes: 75 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,75 @@
# saol
simple array-oriented language
# saol (simple array-oriented language)
## "Hello world!" programm
```
@|(Hello world!)(-!)
```

## picking
+ `saol` -- standard interpreter
+ `isi` -- interactive interpreter
+ `ssp` -- simple standard preprocessor

## Overview
+ `(` / `)` -- take everything in parentheses as a whole works like quotation marks in other languages (`(word1 word2)` - will be read as "word1 word2")
+ `:` -- initialize the current selected element with a value (`:12` - now element 0 stores the value 12)
+ `^` -- go to the item with the number (`^123` - now 123 is the current work item)
+ `>` / `<` -- move right / left in the array (`>>` - move the current work item pointer 2 items forward)
+ `_!` -- display the value of the current item (`:123(_!)` - displays the value of element 123 on the screen)
+ `~` -- a comment that continues until the next language command (`~ comment`)
+ `|` -- fills the array from the current position with elements (`|6 8 2` - the numbers 6, 8, 2 will be added to the array)
+ `-!` -- displays the values of all array elements (`^0|6 8 12(-!)` - displays 6, 8, 12 if the array was initially empty)
+ `;` -- reports that the data entered is a number (`;:12` - writes 12 to the currently selected element, and reports that it is a number)
+ `@` -- indicates that the input data is characters (`@:A` - writes the letter 'A' to the currently selected element)
+ `+` -- returns the sum of all array elements in element 2047 (`;|12 56 9+^2047(_!)` - displays the sum of 12, 56, and 9)
+ `'` -- returns the difference of all array elements in element 2047 (`;|12 56 9'^2047(_!)` - will represent the difference between 12, 56, and 9)
+ `*` -- returns the product of all array elements in element 2047 (`;|12 56 9*^2047(_!)` - displays the product 12, 56, and 9)
+ `/` -- returns the quotient of all array elements in element 2047 (`;|12 56 9/^2047(_!)` - displays private 12, 56, and 9)
+ `#` -- filling an array with specific values (`;#0` - fills the array with zeros)
+ `[` / `]` -- limit the scope of commands (`[0]2(-!)` - displays the values of elements from 0 to 2)
+ `:-` -- copy the value of the current item to the selected one (`:123(:-)2` - now element 2 stores the value 123)
+ `!-` -- copies the inverted value from the current work item to the selected one (`:123(!-)2` - now element 2 stores 0)
+ `&` -- returns the conjunction of all array elements in element 2047 (`|1 2 3&` - in element 2047, 1 will be returned)
+ `\` -- returns the disjunction of all array elements in element 2047 (`|1 2 0\` - in element 2047, 1 will be returned)
+ `?~` -- predicative execution tool, if the result of the previous operation is true, then all subsequent commands will be executed, if it is not, then all subsequent operations will be skipped, analogous to "if" in other languages (`|1 2 3+(?~)^0|(true)@(-!)` - will display "true", since 1+2+3 not equal to 0)
+ `?!` -- inverts the result of the previous operation, similar to else in other languages (`|0 0 0+(?~)^0|(true)@(-!)(?!)|(false)@(-!)` - will output "false" as 0+0+0 early 0)
+ `|~` -- iterator, performs some action on all elements of the array (`(|~)(_! )` - displays the values of all elements of the array, in fact analog ( -!), it is important that operations that must be performed iteratively are enclosed in brackets and end with a space)
+ `<->` -- exchanges values between the current work item and the selected one (`^2047(<->)2` - the values of elements 2047 and 2 will be reversed)

## Some remarks
+ some commands must be surrounded by parentheses, as follows: `(_!)`, `(-!)`, `(:-)`, `(!-)`, `(?~)`, `(?!)`, `(|~)`, `(<->)
+ specifically for saol, I wrote a preprocessor called ssp (standard SAOL preprocessor), it runs separately from the main interpreter, and has the following features:
+ `.link <file_1> <file_2> ... <file_n>` -- connecting third-party files
+ `.macro <name> <expr>` -- creates a macro named name, the next time it is encountered, expr will be substituted for it
+ `.prog` -- end of the preprocessor command block and start of the program

### Template for using a preprocessor in a program
```
.link...
.macro...
.prog
~ your programm
```

## Installation and use
### Installation
to install, you will need:
+ C compiler (gcc, clang)
+ git
+ make

###### typical installation scenario
```
git clone https://github.com/Centrix14/saol
cd saol
make saol
make isi
make ssp
```

### use
```
./saol my_programm.saol // for simple interpretation
./ssp my_programm.saol out.saol // for preprocessing my_programm.saol in out.saol
./isi // to call an interactive interpreter
```

0 comments on commit cf4ec67

Please sign in to comment.