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

18
LINES

< > BotCompany Repo | #1026470 // Creator/Critic Parser Spike v1

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

Download Jar. Libraryless. Click here for Pure Java version (8439L/60K).

1  
!7
2  
3  
abstract sclass Proposal { toString { ret sfu(this); } }
4  
static noToString record TwoSplit(LS a, LS b) extends Proposal {}
5  
static noToString record ThreeSplit(LS a, LS b, LS c) extends Proposal {}
6  
7  
svoid parse(LS tok) {
8  
  // drop first and last
9  
  if (l(tok) >= 3)
10  
    emit(new ThreeSplit(ll(first(tok)), dropFirstAndLast_noNewList(tok), ll(last(tok))));
11  
  for (int i = 1; i < l(tok)-1; i++)
12  
    emit(new TwoSplit(subList(tok, 0, i), subList(tok, i)));
13  
}
14  
15  
p-exp {
16  
  LS tok = javaTokC("[(a|b), (c|d), (e|f)]");
17  
  parse(tok);
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: #1026470
Snippet name: Creator/Critic Parser Spike v1
Eternal ID of this version: #1026470/5
Text MD5: 895a8a33e45441a6fb2a887acb968378
Transpilation MD5: 29f27059c2da48e1464250d49454e692
Author: stefan
Category: javax
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-01-05 04:53:08
Source code size: 545 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 313 / 873
Version history: 4 change(s)
Referenced in: [show references]