progs/lexer/token.sc
changeset 729 b147a10be8dd
parent 725 f345e89895f5
child 827 67c8a6e6a305
equal deleted inserted replaced
728:c669b39debe3 729:b147a10be8dd
    52   for (i <- 0 to 20 by 5) {
    52   for (i <- 0 to 20 by 5) {
    53     println(f"$i%2.0f: ${time(tokenise(prog3 * i))._2}")
    53     println(f"$i%2.0f: ${time(tokenise(prog3 * i))._2}")
    54   }
    54   }
    55 
    55 
    56 }
    56 }
       
    57 
       
    58 
       
    59 
       
    60 
       
    61 
       
    62 
       
    63 
       
    64 
       
    65 
       
    66 
       
    67 
       
    68 
       
    69 
       
    70 
       
    71 // Primes program
       
    72 //================
       
    73 
       
    74 /*
       
    75 end := 100;
       
    76 n := 2;
       
    77 while (n < end) do {
       
    78   f := 2;
       
    79   tmp := 0;
       
    80   while ((f < n / 2 + 1) && (tmp == 0)) do {
       
    81     if ((n / f) * f == n) then  { tmp := 1 } else { skip };
       
    82     f := f + 1
       
    83   };
       
    84   if (tmp == 0) then { write(n) } else { skip };
       
    85   n  := n + 1
       
    86 }
       
    87 */
       
    88 
       
    89 // Factors program
       
    90 //=================
       
    91 
       
    92 /*
       
    93 write "Input n please";
       
    94 read n;
       
    95 write "The factors of n are";
       
    96 f := 2;
       
    97 while n != 1 do {
       
    98     while (n / f) * f == n do {
       
    99         write f;
       
   100         n := n / f
       
   101     };
       
   102     f := f + 1
       
   103 }
       
   104 */