irishman 1.0.0 irishman: ^1.0.0 copied to clipboard
A generic programming language interpreter, linter, formatter, and all that jazz, written in Dart.
import 'package:irishman/irishman.dart';
void main() {
var tokenizer = const Tokenizer(
keywords: [
Keyword("if"),
Keyword("else"),
],
symbols: [
Symbol(">=", "Greater than or equals"),
Symbol("(", "Start Paren"),
Symbol(")", "End Paren"),
Symbol("{", "Increase Scope"),
Symbol("}", "Decrease Scope"),
],
);
print(
'All the token constants are: \n - ${tokenizer.getAllTokenNames().join("\n - ")}');
print("");
print("The output to `if (4 >= 4) { } else { }` is:");
print(tokenizer
.tokenizeString("if(4>=5){}else{}")
.map((e) => "${e.tokenName}:${e.data}")
.join(", "));
}