yeolde
This commit is contained in:
@@ -20,6 +20,3 @@
|
|||||||
// Do until condition is met
|
// Do until condition is met
|
||||||
#define until(what) while(!(what))
|
#define until(what) while(!(what))
|
||||||
|
|
||||||
// Because why the hell not
|
|
||||||
#define whilst(what) while((what))
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
/**
|
||||||
|
Ye Olde Control Structures
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "loops.h"
|
||||||
|
|
||||||
|
#define whilst(what) while((what))
|
||||||
|
#define when(what) if((what))
|
||||||
|
#define otherwise else
|
||||||
|
#define commence {
|
||||||
|
#define then {
|
||||||
|
#define cease }
|
||||||
|
#define choose(what) switch((what))
|
||||||
|
#define option case
|
||||||
|
#define shatter break
|
||||||
|
#define replay continue
|
||||||
|
#define equals ==
|
||||||
|
#define is ==
|
||||||
|
#define be =
|
||||||
|
#define over >
|
||||||
|
#define above >
|
||||||
|
#define under <
|
||||||
|
#define below <
|
||||||
|
#define let /**/
|
||||||
|
#define raise(what) (what)++
|
||||||
|
|
||||||
|
#define number int
|
||||||
@@ -13,7 +13,7 @@ void main()
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
until (i == 100) i++;
|
until (i == 100) i++;
|
||||||
|
|
||||||
whilst (i > 0) {
|
until (i == 0) {
|
||||||
i--;
|
i--;
|
||||||
printf("i = %d\n", i);
|
printf("i = %d\n", i);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include "lib/loops.h"
|
||||||
|
#include "lib/yeolde.h"
|
||||||
|
|
||||||
|
void main()
|
||||||
|
commence
|
||||||
|
let number a be 0;
|
||||||
|
whilst (a under 13)
|
||||||
|
commence
|
||||||
|
raise (a);
|
||||||
|
|
||||||
|
when (a is 5)
|
||||||
|
then
|
||||||
|
printf("A is ugly 5\n");
|
||||||
|
replay;
|
||||||
|
cease;
|
||||||
|
|
||||||
|
choose (a)
|
||||||
|
commence
|
||||||
|
option 1:
|
||||||
|
printf("A is 1\n");
|
||||||
|
shatter;
|
||||||
|
option 2:
|
||||||
|
printf("A is 2\n");
|
||||||
|
shatter;
|
||||||
|
option 3:
|
||||||
|
printf("Neither 1 nor 2\n");
|
||||||
|
cease;
|
||||||
|
cease;
|
||||||
|
cease
|
||||||
Executable
BIN
Binary file not shown.
Reference in New Issue
Block a user