esolang/languages/deadfish/constants.ts
2022-01-30 20:47:33 +05:30

46 lines
886 B
TypeScript

import { MonacoTokensProvider } from "../types";
export type DFRS = {
value: number;
};
export enum DF_OP {
INCR = "i",
DECR = "d",
SQ = "s",
OUT = "o",
}
/** A single element of the program's AST */
export type DFAstStep = {
instr: DF_OP;
location: { line: number; char: number };
};
/** Sample program printing "Hello world" */
export const sampleProgram = [
"iisiiiisiiiiiiiio",
"iiiiiiiiiiiiiiiiiiiiiiiiiiiiio",
"iiiiiiioo",
"iiio",
"dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddo",
"dddddddddddddddddddddsddo",
"ddddddddo",
"iiio",
"ddddddo",
"ddddddddo",
].join("\n");
/** Tokens provider */
export const editorTokensProvider: MonacoTokensProvider = {
tokenizer: {
root: [
[/i/, "orange"],
[/d/, "red"],
[/s/, "blue"],
[/o/, "green"],
],
},
defaultToken: "comment",
};