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

sclass LCLongerProds {
  LS literals;
  new TreeMap<Int, L<Int>> productions;
  Map<S, L<Int>> files;
  
  S itemToString(int idx) {
    new StringBuilder buf;
    itemToString_step(buf, idx);
    ret str(buf);
  }
  
  void itemToString_step(StringBuilder buf, int idx) {
    if (idx < l(literals))
      buf.append(literals.get(idx));
    else for (int i : productions.get(idx))
      itemToString_step(buf, i);
  }
}

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