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

18
LINES

< > BotCompany Repo | #1028857 // LCLongerProds - LineComp format with longer productions (not just pairs)

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2467L/16K).

1  
sclass LCLongerProds {
2  
  LS literals;
3  
  new TreeMap<Int, L<Int>> productions;
4  
  Map<S, L<Int>> files;
5  
  
6  
  S itemToString(int idx) {
7  
    new StringBuilder buf;
8  
    itemToString_step(buf, idx);
9  
    ret str(buf);
10  
  }
11  
  
12  
  void itemToString_step(StringBuilder buf, int idx) {
13  
    if (idx < l(literals))
14  
      buf.append(literals.get(idx));
15  
    else for (int i : productions.get(idx))
16  
      itemToString_step(buf, i);
17  
  }
18  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028857
Snippet name: LCLongerProds - LineComp format with longer productions (not just pairs)
Eternal ID of this version: #1028857/2
Text MD5: 1894f6d8290f237545a2b396983a6545
Transpilation MD5: 897739277a82c517249ba57fd851f621
Author: stefan
Category: javax / linecomp
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-10 13:59:08
Source code size: 436 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 199 / 489
Version history: 1 change(s)
Referenced in: [show references]