Skip to content

Instantly share code, notes, and snippets.

@mauro-balades
Created April 14, 2022 19:44
Show Gist options
  • Save mauro-balades/104a032acfb877461fb8ddde8c8d7fb8 to your computer and use it in GitHub Desktop.
Save mauro-balades/104a032acfb877461fb8ddde8c8d7fb8 to your computer and use it in GitHub Desktop.
Run BASIC code in c++
#ifndef __BASIC_CPP_H__
#define __BASIC_CPP_H__
#define DO {
#define END }
#define IF(x) if (x)
#define ELSE } else
#define DEFINE(T, x, v) T x = v;
#define GO_TO(x) goto x;
#define RETURN(x) return x;
#define FOR(x) for (x)
#define WHILE(x) while(x)
#endif /* __BASIC_CPP_H__ */
#include "basic.cpp"
int main() DO
DEFINE(int, i, 1)
WHILE(i < 10) DO
IF (i==5) DO
printf("Half way throught!\n");
ELSE IF (i == 1) DO
printf("Start!");
ELSE
printf("I: %i\n", i);
END
i++;
END
END
@Khhs167
Copy link

Khhs167 commented Aug 17, 2022

lol basic is bigger right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment