Mercurial > repo
view share/delvs-master/bf.h @ 7910:7d5f1c5e44b1
<moon__> mkx bin/hfs//erro You have discovered an eerie caven. The air above the dark stone floor is alive with vorices of purple light and dark, boiling clouds. Seemingly bottomless glowing pit mark the surface.
author | HackBot |
---|---|
date | Sat, 07 May 2016 00:41:47 +0000 |
parents | 38a5b4d8a98e |
children |
line wrap: on
line source
#include <stdio.h> #define c g->code #define p g->pointer #define f g->file struct Data { const char *code; char vars[30000]; char *pointer; }; void dummyLexer(struct Data *g) { while(*c) if(*c++ == ']') return; } void lexer(struct Data *g) { const char *cc = c; while(*c) { switch (*c++) { case '>': ++p; break; case '<': --p; break; case '+': ++*p; break; case '-': --*p; break; case '.': putchar(*p); break; case ',': *p = getchar(); break; case '[': cc = c; if(!*p) dummyLexer(g); while(*p) { c = cc; // restore char position to start of loop lexer(g); } break; case ']': return; default: // everything else is comments break; } } return; } /* * Usage: * struct Data g; * g.code = file; * g.pointer = &g.data[15000]; * lexer(&g); */