#include "stdio.h" #include "stdlib.h" char code[1000]; char data[10][100]; int ip[100]; int dx[100]; int dt[100]; char output[100]; int op[100]; int skip(int i){ while(code[i] != ')') if(code[i] == '(') i = skip(i+1); else i++; return i; } int exec(int ct,int ei){ printf("exec %d %d\n",ct,ei); int i = ip[ct]; int x = dx[ct]; int t = dt[ct]; int o = op[ct]; while(i<ei){ printf("%d %d %d %d : %c\n",ct,i,x,t,code[i]); if(code[i] == '>') if(x<9) x++; else x=0; if(code[i] == '<') if(x>0) x--; else x=9; if(code[i] == 'v'){ exec(t,i+1); if(t<99) t++; } if(code[i] == '^') if(t>0) t--; if(code[i] == '(') if(data[x][t] == 0) i = skip(i+1); if(code[i] == '|') { int j; for(j=0;j<10;j++) data[j][ct+1] = data[j][ct]; ip[ct]=i; dx[ct]=x; dt[ct]=t; op[ct]=o; ct++; t++; } if(code[i] == '+')data[x][t]++; if(code[i] == '-')data[x][t]--; if(code[i] == '.'){ output[o++] = data[x][t]; printf("%d was %d or '%c' at %d\n",x,data[x][t],data[x][t],t); } i++; } printf("end exec\n"); } int main(){ int i; for(i=0;i<1000;i++) if((code[i]=getchar())=='#') break; code[i]=0; puts(code); exec(0,i); puts(output); for(i=0;i<10;i++)printf("%d\n",output[i]); }
Register and join over 40,000 other developers!
Recent Topics
-
The Game You Are Waiting For?
WendellHarper - Dec 06 2020 01:21 PM
-
Quora and Reddit Backlinks
WendellHarper - Dec 06 2020 01:14 PM
-
Delete account
pindo - Jul 23 2020 01:33 AM
-
Print specific values from dictionary with a specific key name
Siten0308 - Jun 20 2019 01:43 PM
-
Learn algorithms and programming concepts
johnnylo - Apr 23 2019 07:49 AM
Recent Blog Entries
Recent Status Updates
Popular Tags
- networking
- Managed C++
- stream
- console
- database
- authentication
- Visual Basic 4 / 5 / 6
- session
- Connection
- asp.net
- import
- syntax
- hardware
- html5
- array
- mysql
- java
- php
- c++
- string
- C#
- html
- loop
- timer
- jquery
- ajax
- javascript
- programming
- android
- css
- assembly
- c
- form
- vb.net
- xml
- linked list
- login
- encryption
- pseudocode
- calculator
- sql
- python
- setup
- help
- game
- combobox
- binary
- hello world
- grid
- innerHTML

Esoteric language: Timef**k
Started by Aereshaa, Dec 10 2009 08:31 PM
No replies to this topic
#1
Posted 10 December 2009 - 08:31 PM
I wrote this interpreter in C for my esoteric language Timef**k
Watches: Nanoha, Haruhi, AzuDai. Listens to: E-Type, Dj Melodie, Nightcore.
"When people are wrong they need to be corrected. And then when they can't accept it, an argument ensues." - MeTh0Dz
"When people are wrong they need to be corrected. And then when they can't accept it, an argument ensues." - MeTh0Dz
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download