irishman 1.0.8 irishman: ^1.0.8 copied to clipboard
A generic programming language interpreter, linter, formatter, and all that jazz, written in Dart.
import 'package:irishman/irishman.dart';
void main() {
ex1();
ex2();
ex3();
}
void ex1() {
var language = Language.fromJSONFile("./example/simple-lang.json");
print(language.getTextmateGrammar().asJSONText());
}
void ex2() {
var language = Language.fromJSONFile("./example/simple-lang.json");
print("# ${language.emoji} ${language.name}");
print(language.description);
print("");
print("## File Endings:");
print(language.fileTypes.join(', '));
}
void ex3() {
var language = Language.fromJSONFile("./example/simple-lang.json");
var tokenizer = language.getTokenizer();
const code =
"int i = 0x00; repeat { print(\"Hello World\"); i++; if (i > 500) { stop; } }";
print("The output to `$code` is:");
print(tokenizer
.tokenizeString(code)
.map((e) => "${e.tokenName}:\"${e.data}\"")
.join(", "));
}