-/** fac1 = "(" expr ")" */
-let fac1 = circumfix((x : TokenMatcheePair)=>
-thenDo(thenDo(thenDo(tk.toSome(x), tLParen), expr), tRParen), "fac1");
-
-let fac2 = tInt;
-
+/**
+ * TODO: 12(13)(14) only parsed with only 12(13)
+ */
+/** single1 = tInt | "(" expr ")"*/
+let single1 = circumfix((x : TokenMatcheePair) =>
+ thenDo(thenDo(thenDo(tk.toSome(x), tLParen), expr), tRParen), "fac1");
+let single2= tInt;
+let single = orDo(single1, single2);
+
+/** fac1 = single "(" int ")" | single */
+let fac1Appliee = circumfix((x : TokenMatcheePair) => thenDo(thenDo(thenDo(tk.toSome(x), tLParen), tInt), tRParen), "fac1");
+let fac1 = (x : TokenMatcheePair) =>
+ {
+ let n = thenDo(thenDo(toSome(x), single), fac1Appliee);
+
+ console.log("+"+"bocchitherock"+"+"+repr(n));
+
+ return n
+ };
+let fac2 = single;