comparison delvs-master/README.md @ 3122:276f475af97b

<L8D> tar xf master.tar.gz
author HackBot
date Sun, 16 Jun 2013 06:17:41 +0000
parents
children
comparison
equal deleted inserted replaced
3121:38bec9e9e910 3122:276f475af97b
1 Delvs
2 =====
3
4 Delvs(Pronounced Del-vis) is my own personal variation of brainfuck, the interpreter is written in C.
5 File reading was inspired by brainfuck++, and the bit fiddling was inspired by boolfuck(DuckDuckGo them if you have to, I'm not putting links there right now)
6
7 Additions
8 ---------
9 - `:` casts the current value to a string and prints it. Code: `printf("%hhd", *p);`
10 - `;` grabs value from user input and casts to cell value. Code: `scanf("%hhd", p);`
11 - `#` reads following cells as null-terminating string for filename, then if current cell is != 1, open file for reading, or if 1, open file writing. Code: `f = fopen(p + 1, p == 1 ? "w" : "r");`
12 - `` ` `` read next char from file, apply to current cell. (`EOF` becomes `0`) Code: `*p = fgetc(f);`
13 - `!` write char from current cell to file. Code: `fputc(*p, f);`
14 - `"` increment current bit position by 1. (psuedo)Code: `b++;`
15 - `'` flip bit at current bit position, then incrment current bit position by 1. Code: `*p ^= (1 << b)`
16 - `\ ...` ignore EVERYTHING until newline is reached. `while(*c) if(*c++ == '\') return;`
17 - `@` prints value of current cell and surrounding 4 cells. Code:
18 - `$` sleeps the current cell's value in seconds
19
20 ### To do
21 - implement a working socket system
22 - implement an stdout flushing system
23 - implement runtime args
24 - implement namespaces(seperate arrays of 30000 chars)
25 - (maybe) implement better way to divide
26 - implement full integers
27
28 Examples
29 --------
30 Setting entire cell values with just the bit intructions is as easy as converting 0's to `"`s and 1's to `'`s.
31
32 01001000 = 72
33 "'""'""" . >
34 01101001 = 105
35 "''"'""' .
36
37 Block comments are very straight forward to use, just plant a `\[` when you start "commenting" and a `]` when you're done.
38
39 +++++ +++++ [
40 > +++++ ++
41 > +++++ +++++
42 \ This is a well placed comment. See, all these code intrustions aren't messing with the program unlike vanilla Brainfuck
43 > +++
44 > +
45 <<<< -
46 ]
47 > ++ .
48 > + .
49 +++++ ++ . .
50 \ Another intruding comment.
51 +++ .
52 > ++ .
53 << +++++ +++++ +++++ .
54 > . +++ .
55 ------ . -------- .
56 > + .
57 > .
58
59 How about reading files? Just generate a string as the filename an the use a `#` at the beginning of it. Like so:
60
61 01101101 m
62 "''"''"'
63 01111001 y
64 "''''""'
65 01110100 t
66 "'''"'""
67 01100101 e
68 "''""'"'
69 01111000 x
70 "''''"""
71 01110100 t
72 "'''"'""
73 01100110 f
74 "''""''"
75 01101001 i
76 "''"'""'
77 01101100 l
78 "''"''""
79 01100101 e
80 "''""'"'
81 00101110\.
82 ""'"'''"
83 01110100 t
84 "'''"'""
85 01111000 x
86 "''''"""
87 01110100 t
88 "'''"'""
89
90 [<] #
91 \ standard concatenation loop with file reading(and EOF check)
92 `+[-.`+]
93
94 Want to give the actual value of the cell when printing? Just add a dot above your intruction!
95
96 01100100 \ 'd' or 100
97 "''""'""
98
99 . \ prints "d"
100 : \ prints "100"