#include #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto t = uc.NewTransformer(); t.Pattern("{@Define: Var: Count_a = 0}"); t.Pattern("{@Define: Var: Count_an = 0}"); t.FromTo("a", "{@Self}{@Exec: Count_a++}"); t.FromTo("an", "{@Self}{@Exec: Count_an++}"); t.FromTo(".", R"({@nl}'a' occurs {@Eval: Count_a} times 'an' occurs {@Eval: Count_an} times)"); // Note: it is counting "a" as a token, not as a character. cout << t.Transform("An apple, an eagle, a cat, an orange, a tree.") << endl; }