Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

33
LINES

< > BotCompany Repo | #1017053 // Ambiguous Grouping Spike [dev.]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Uses 3874K of libraries. Click here for Pure Java version (7800L/56K).

!7

/*sclass AppliedRules {
  new Set<Pair<O, L>> appliedRules; // rule + arguments
}*/

p-exp {
  S input = [[input contains $a && $a sounds like $b => ProposeInnerRewrite($a, $b)]];
  
  new LinkedHashSet<LS> propositions;
  propositions.add(tok_groupRoundBrackets(input));
  LS ops = map unquote(generalDefinition_rev("a binary operator"));
  printStruct(ops);
  while licensed {
    for (LS tok : cloneList(propositions))
      for (S op : ops) {
        L<S> tokOp = javaTok(op);
        L<Int> l = jfindAll(tok, tokOp);
        for (int i : l) {
          L<S> newTok = ll(
            "",
            trimJoinSubList(tok, 0, i-1),
            " ",
            op,
            " ",
            trimJoinSubList(tok, i+l(tokOp)-2),
            "");
          if (propositions.add(newTok))
            print(op + " => " + sfu(newTok));
        }
      }
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

-
Snippet ID: #1017053
Snippet name: Ambiguous Grouping Spike [dev.]
Eternal ID of this version: #1017053/8
Text MD5: 651620c70f7c26319e4f63d7d54286ff
Transpilation MD5: 68082da5290391cc4276a8d73b085c82
Author: stefan
Category: javax / parsing
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-11 15:03:35
Source code size: 894 bytes / 33 lines
Pitched / IR pitched: No / No
Views / Downloads: 461 / 1026
Version history: 7 change(s)
Referenced in: