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

42
LINES

< > BotCompany Repo | #657 // Command processor (developing)

JavaX source code - run with: x30.jar

!636
!standard functions
!multi-line strings

main {
  psvm {
    String cmd = "expand #655";
    String[] words = cmd.split(" +");
    System.out.println(words[0]);
    System.out.println(words[1]);
    String sentence = "You want to " + quote(words[0]) + " " + quote(words[1]) + ".";
    System.out.println(sentence);
    
    Engine engine = new Engine();
    engine.rules.add(new Rule(
      [[You want to "expand" A.]],
      [[You should run "#todo" with argument A.]]));
  }
  
  static class Form {
    String pattern;
    List<String> elements = new ArrayList<String>();
  }
  
  static Form parseForm(String s) {
    return new Form();
    // TODO
  }
  
  static class Rule {
    Form ante, post;
    
    Rule(String ante, String post) {
      this.ante = parseForm(ante);
      this.post = parseForm(post); 
    }
  }
  
  static class Engine {
    List<Rule> rules = new ArrayList<Rule>();
  }
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #657
Snippet name: Command processor (developing)
Eternal ID of this version: #657/1
Text MD5: 427e9a4d0a07721c9875aaa1d88204e3
Author: stefan
Category:
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-07-06 18:30:39
Source code size: 950 bytes / 42 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 669 / 592
Referenced in: [show references]