Program does not run after successfully pointing to the execution location

Question:
I have made (or was attempting to create) a turing complete novelty “pRoGrAmMiNg LaNgUaGe” and it successfully pointed to where it was going to execute, but then fails to.
Repl link:
https://replit.com/@-jpg/clank-000#main.clk

Output:

pedro? [y/n]:y
['0001', 'IF', 'IS_PEDRO', 'STR', 'y', '0002', '0003'], [0001]
found
0002
['0002', 'INP', '0000', 'RES', 'no', 'pedro', ':('], [0001]
['0003', 'INP', '0000', 'RES', 'yes', 'pedro', ':)'], [0001]
done

pedro? [y/n]:y

this is an input, the y at the end means you typed a y

['0001', 'IF', 'IS_PEDRO', 'STR', 'y', '0002', '0003'], [0001]
['0002', 'INP', '0000', 'RES', 'no', 'pedro', ':('], [0001]
['0003', 'INP', '0000', 'RES', 'yes', 'pedro', ':)'], [0001]

the first list in each line is the tokenized code. alongisde it, in brackets (so you see there is no space) is the searching pointer.
it checks if the first element of that list is it, if so, starts executing that line of code.
I guess i should explain syntax for clank while we are here
IF IS_PEDRO STR y 0002 0003
if gets recognized by the interpreter and executes the code for it from clank_op folder
is_pedro is the first thing to be compared, and has to be in variable form
str tells the if interpreter (yes there is kind-of sub interpreters) that it is gonna compare is_pedro with a string
y is the string
0002 0003 jump to 0002 if true, else jump to 0003

INP 0000 RES no pedro :(
inp gets recognized by the interpreter and starts forming an input
0000 tells it to move to 0000 when done
res variable name to write to
everything after gets written to the screen as input. i use inputs here because i made inputs before print???

found
0002

found means it found the address
0002 means its pointing to line 0002 to start executing.

done

the processor function process() finished pointing to and executing the data, required for any function.

if you would like to debug this by creating your own module in clank_op, set moveto to the line you want to move to after, and proccess() finishes this and actually moves to that address. process() is required at the end as it leads to executing the next line of code. you also need to define read yourself

for example, a simple if function in psuedo code:

read = line.split() # required (for input)
if this = that:
    moveto = read[input number] # required for selecting line to move to
else:
    moveto = read[input number] # required for above reason

process() # required (for moving to next instruction)

With a little bit of tweaking, now:

pedro? [y/n]:y
['0001', 'IF', 'IS_PEDRO', 'STR', 'y', '0002', '0003'], [0001]
found
unsupported type: 0001
['0002', 'INP', '0000', 'RES', 'no', 'pedro', ':('], [0001]
['0003', 'INP', '0000', 'RES', 'yes', 'pedro', ':)'], [0001]
done

the IF is reading its own address: 0001

Theoretically, this could mean the three inputs for INP are getting put into IF’s memory, but it should rewrite read (the tokenization of the code) every time it or a new function gets called.

Another problem to face is that it does not change the line searcher from 0001, as you can see in code output.

I forked and printed read. When you are executing the if is actually using the next line.
I believe this is because you use exe and read a line again instead of passing the one you already read.

I will delete the fork now.

oh why did u delete the fork if you fixed it?

“in psuedocode” it’s funny because if you add a single = it’ll be valid python code

1 Like

i have no idea how to fix that- example would be cool too

I do fork to understand a bit the code but then I delete it because I have no use for it,

I can look at it again.

ok if you are able to fix that, that would be great

Maybe this helps …

https://replit.com/@fpessolano/clank-000?s=app

1 Like