EZLang, 'easy' esoteric programming language
Have four feauture :
- Sentiency
- Convenience
- Readability
- Expendability
Can read Korean? My blog link here.
Like turing machine, memory with infinite size is provided.
There are 7 instructors in EZLang
- MEM(N, U = 0). Go to
N
th memory. IfU
is 1, Go to +N
th memory. Use likeMEM(3)
orMEM(1, 1)
- SET(V, U = 0). Set current memory to
V
. IfU
is 1, AddV
to current memory. Use likeSET(5)
orSET(-1, 1)
- JLZ(N). Jump to
N
th instructor if current memory is less than zero. Use likeJLZ(3)
. Note that first line is 1, not 0. - GET(C = 0). Get a number and set current memory to the number. if
C
is 1, Get a character and set current memory to unicode number of the character. - PRT(C = 0). Same as
GET
, except it prints. - HLT(). Halt program.
- NEG(). Save negative number to current memory.
...And anything following )
is comment.
This is program which get two numbers for input, and print sum of the numbers.
MEM(0) plus. when first made this language
SET(-1)
MEM(1)
GET()
MEM(2)
GET()
MEM(1)
SET(-1, 1)
JLZ(14)
MEM(2)
SET(1, 1)
MEM(0)
JLZ(7)
MEM(2)
PRT()
HLT()
python(.exe) ezlang.py your_file (d to debug)
First, make new class with this format :
class Yourclass(Instructor):
def __init__(self):
self.ins_name = "(name)"
self.par_count_min = 0 # minimum parameter
self.par_count_max = 0 # maximum parameter
def process(self, param, state):
super(Yourclass, self).process(param, state)
#and your code
Second, write your code. You can access to variables with state.variable
.
There is five variable you can access, mem_place
, mem_list
, excuting
, ins_place
(When get, it is 0-based, and when set, it is 1-based.), output_list
, mem
(current memory)
Third, add your new instructor in get_instructor_list
method of Instructor
class.
Done!