Author Topic: Try to Recreate a Small Interpreter/Compiler  (Read 7195 times)

0 Members and 1 Guest are viewing this topic.

Offline Calloway

  • Newbie
  • Posts: 18
  • I still have Laser Disc...
    • View Profile
    • Calloway Sutton
Try to Recreate a Small Interpreter/Compiler
« on: July 17, 2017, 11:55:00 pm »
A small challenge for if your bored
Here 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


Offline Aureal

  • Newbie
  • Posts: 17
  • memes
    • View Profile
Re: Try to Recreate a Small Interpreter/Compiler
« Reply #1 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.  

Offline luke

  • Administrator
  • Seasoned Forum Regular
  • Posts: 324
    • View Profile
Re: Try to Recreate a Small Interpreter/Compiler
« Reply #2 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

Offline Calloway

  • Newbie
  • Posts: 18
  • I still have Laser Disc...
    • View Profile
    • Calloway Sutton
Re: Try to Recreate a Small Interpreter/Compiler
« Reply #3 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
It's what it's mainly based off of