Rename directory "engines" to "languages"
This commit is contained in:
79
languages/befunge93/constants.ts
Normal file
79
languages/befunge93/constants.ts
Normal file
@@ -0,0 +1,79 @@
|
||||
import { MonacoTokensProvider } from "../types";
|
||||
|
||||
export type Bfg93RS = {
|
||||
stack: number[];
|
||||
direction: Bfg93Direction;
|
||||
strMode: boolean;
|
||||
};
|
||||
|
||||
/** Direction of program counter */
|
||||
export enum Bfg93Direction {
|
||||
UP = "up",
|
||||
DOWN = "down",
|
||||
LEFT = "left",
|
||||
RIGHT = "right",
|
||||
}
|
||||
|
||||
/** Allowed operations in Befunge */
|
||||
export enum Bfg93Op {
|
||||
NOOP = " ",
|
||||
ADD = "+",
|
||||
SUBTRACT = "-",
|
||||
MULTIPLY = "*",
|
||||
DIVIDE = "/",
|
||||
MODULO = "%",
|
||||
NOT = "!",
|
||||
GREATER = "`",
|
||||
RIGHT = ">",
|
||||
LEFT = "<",
|
||||
UP = "^",
|
||||
DOWN = "v",
|
||||
RANDOM = "?",
|
||||
H_IF = "_",
|
||||
V_IF = "|",
|
||||
TOGGLE_STR = '"',
|
||||
DUPLICATE = ":",
|
||||
SWAP = "\\",
|
||||
POP_DELETE = "$",
|
||||
POP_OUTINT = ".",
|
||||
POP_OUTCHAR = ",",
|
||||
BRIDGE = "#",
|
||||
GET_DATA = "g",
|
||||
PUT_DATA = "p",
|
||||
STDIN_INT = "&",
|
||||
STDIN_CHAR = "~",
|
||||
END = "@",
|
||||
PUSH_0 = "0",
|
||||
PUSH_1 = "1",
|
||||
PUSH_2 = "2",
|
||||
PUSH_3 = "3",
|
||||
PUSH_4 = "4",
|
||||
PUSH_5 = "5",
|
||||
PUSH_6 = "6",
|
||||
PUSH_7 = "7",
|
||||
PUSH_8 = "8",
|
||||
PUSH_9 = "9",
|
||||
}
|
||||
|
||||
/** Sample program printing "Hello world" */
|
||||
export const sampleProgram = [
|
||||
`"!dlroW ,olleH">:v`,
|
||||
` |,<`,
|
||||
` @`,
|
||||
].join("\n");
|
||||
|
||||
/** Tokens provider */
|
||||
export const editorTokensProvider: MonacoTokensProvider = {
|
||||
tokenizer: {
|
||||
root: [
|
||||
[/[\>\^<v\?]/, "red"],
|
||||
[/[\+\-\*\/%!`]/, "orange"],
|
||||
[/[|_]/, "blue"],
|
||||
[/[":\\#]/, "green"],
|
||||
[/[\$\.,]/, "violet"],
|
||||
[/[gp@]/, "indigo"],
|
||||
[/[&~0-9]/, "turquoise"],
|
||||
],
|
||||
},
|
||||
defaultToken: "comment",
|
||||
};
|
||||
Reference in New Issue
Block a user