irishman 1.0.8 copy "irishman: ^1.0.8" to clipboard
irishman: ^1.0.8 copied to clipboard

A generic programming language interpreter, linter, formatter, and all that jazz, written in Dart.

example/irishman_example.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(", "));
}
2
likes
130
pub points
0%
popularity

Publisher

verified publisherfairfieldprogramming.org

A generic programming language interpreter, linter, formatter, and all that jazz, written in Dart.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

More

Packages that depend on irishman