SS.k 774 B

123456789101112131415161718192021222324252627282930
  1. /helpers
  2. / e exclusive
  3. slice: {[l;s;e] s_(e-1)#l};
  4. listize: {1_(,/(";",)'{"(",x,")"}'x)};
  5. iscl: {i: `i$x; ((i>64) & (i<91))}; // is capital letter
  6. isdig: {i: `i$x; ((i>47) & (i<58))}; // is digit
  7. / :`i$"A"; // 65
  8. / :`i$"Z"; // 90
  9. / :`i$"0"; // 48
  10. / :`i$"9"; // 57
  11. tstkey: "States/Events"; / key indicating start of transition section
  12. cstkey: "Events"; / key indicating start of events condition section
  13. astkey: "Actions"; / key indicating start of actions section
  14. sectionkeys: (tstkey;cstkey;astkey);
  15. lines: 0: "SS.csv";
  16. /csv parser
  17. parsel: {[l] comi: &l=",";comi+:1;r: 2':!#comi;r: comi@r;r: (1 2#(0;r[0;0])),r;slice[l].'r};
  18. csv: parsel'lines;
  19. :letters: &''(iscl'''csv);
  20. :digits: &''(isdig'''csv);
  21. csv@''letters
  22. / initialize data
  23. / f:<`"compiled_ss.k";
  24. / f 0: kcode;