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).

1  
!7
2  
3  
/*sclass AppliedRules {
4  
  new Set<Pair<O, L>> appliedRules; // rule + arguments
5  
}*/
6  
7  
p-exp {
8  
  S input = [[input contains $a && $a sounds like $b => ProposeInnerRewrite($a, $b)]];
9  
  
10  
  new LinkedHashSet<LS> propositions;
11  
  propositions.add(tok_groupRoundBrackets(input));
12  
  LS ops = map unquote(generalDefinition_rev("a binary operator"));
13  
  printStruct(ops);
14  
  while licensed {
15  
    for (LS tok : cloneList(propositions))
16  
      for (S op : ops) {
17  
        L<S> tokOp = javaTok(op);
18  
        L<Int> l = jfindAll(tok, tokOp);
19  
        for (int i : l) {
20  
          L<S> newTok = ll(
21  
            "",
22  
            trimJoinSubList(tok, 0, i-1),
23  
            " ",
24  
            op,
25  
            " ",
26  
            trimJoinSubList(tok, i+l(tokOp)-2),
27  
            "");
28  
          if (propositions.add(newTok))
29  
            print(op + " => " + sfu(newTok));
30  
        }
31  
      }
32  
  }
33  
}

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: 462 / 1027
Version history: 7 change(s)
Referenced in: [show references]