Add Chef language implementation

This commit is contained in:
Nilay Majorwar
2022-01-17 20:57:38 +05:30
parent eb9d5d861c
commit 65aa9c9ecd
25 changed files with 2696 additions and 0 deletions

57
engines/chef/constants.ts Normal file
View File

@@ -0,0 +1,57 @@
import { MonacoTokensProvider } from "../types";
export class SyntaxError extends Error {
constructor(message: string) {
super(message);
this.name = "SyntaxError";
}
}
/** Sample Hello World program for Chef */
export const sampleProgram = [
"Hello World Souffle.",
"",
'This recipe prints the immortal words "Hello world!", in a basically brute force way. It also makes a lot of food for one person.',
"",
"Ingredients.",
"72 g haricot beans",
"101 eggs",
"108 g lard",
"111 cups oil",
"32 zucchinis",
"119 ml water",
"114 g red salmon",
"100 g dijon mustard",
"33 potatoes",
"",
"Method.",
"Put potatoes into the mixing bowl.",
"Put dijon mustard into the mixing bowl.",
"Put lard into the mixing bowl.",
"Put red salmon into the mixing bowl.",
"Put oil into the mixing bowl.",
"Put water into the mixing bowl.",
"Put zucchinis into the mixing bowl.",
"Put oil into the mixing bowl.",
"Put lard into the mixing bowl.",
"Put lard into the mixing bowl.",
"Put eggs into the mixing bowl.",
"Put haricot beans into the mixing bowl.",
"Liquefy contents of the mixing bowl.",
"Pour contents of the mixing bowl into the baking dish.",
"",
"Serves 1.",
].join("\n");
export const editorTokensProvider: MonacoTokensProvider = {
tokenizer: {
root: [
[/Ingredients./, "red"],
[/Method./, "red"],
[/mixing bowl/, "green"],
[/baking dish/, "blue"],
[/\d/, "sepia"],
],
},
defaultToken: "plain",
};