!747 m { static S question = "Is port 80 open?"; static class ThePortOracle { static S isPort_open(S s) { int port = parseInt(s); print("I'll check port " + port + "..."); boolean b = isPortOpen(port); return b ? "Yes, it is open!" : "No, it is not open."; } } static S answerQuestion(S question) { L tok = parse(question); S[] m = match2(parse("is port * open"), tok); if (m != null) return ThePortOracle.isPort_open(m[0]); return unknown(question); } static S unknown(S question) { return "? Unknown question: " + question; } p { if (args.length != 0) question = join(" ", args); print("Q: " + question); S answer = answerQuestion(question); print("A: " + answer); } static L parse(S s) { return tokensToLowerCase(dropPunctuation(javaTokPlusPeriod(s))); } }