QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: Calloway on July 17, 2017, 11:55:00 pm

Title: Try to Recreate a Small Interpreter/Compiler
Post by: Calloway on July 17, 2017, 11:55:00 pm
A small challenge for if your bored
Here (https://github.com/Getindor/small) is what Small is


If you wanna know how it works:
the command '+' adds 1 to the counter
the command '.' prints the ascii character that the counter is on
that's it

Title: Re: Try to Recreate a Small Interpreter/Compiler
Post by: Aureal on July 18, 2017, 02:14:46 pm
lol?

Code: QB64: [Select]
  1.     sleep
  2.         case "+": cnt = cnt + 1
  3.         case ".": print chr$(cnt); " "; "("; cnt; ")"
  4.     end select
  5.     _keyclear
  6.  
Title: Re: Try to Recreate a Small Interpreter/Compiler
Post by: luke on July 18, 2017, 09:34:18 pm
I wouldn't even call that a language; it's a data encoding at best.

It does, however, remind me of Brainfuck, which *is* Turing complete: https://en.m.wikipedia.org/wiki/Brainfuck
Title: Re: Try to Recreate a Small Interpreter/Compiler
Post by: Calloway on July 18, 2017, 09:48:56 pm
I wouldn't even call that a language; it's a data encoding at best.

It does, however, remind me of Brainfuck, which *is* Turing complete: https://en.m.wikipedia.org/wiki/Brainfuck (https://en.m.wikipedia.org/wiki/Brainfuck)
It's what it's mainly based off of