exps/Attic/Spiral.scala
author Christian Urban <urbanc@in.tum.de>
Mon, 11 Feb 2019 23:18:05 +0000
changeset 310 c090baa7059d
parent 304 exps/Spiral.scala@82a99eec5b73
permissions -rwxr-xr-x
cleaned up a bit
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
304
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
     1
import Element.elem
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
     2
import RexpRelated._
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
     3
import RexpRelated.Rexp._
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
     4
object Spiral{
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
     5
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
     6
  val space = elem(" ")
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
     7
  val corner = elem("+")
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
     8
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
     9
  def spiral(nEdges: Int, direction: Int): Element = {
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    10
    if(nEdges == 1)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    11
      elem("+")
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    12
    else {
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    13
      val sp = spiral(nEdges - 1, (direction + 3) % 4)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    14
      def verticalBar = elem('|', 1, sp.height)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    15
      def horizontalBar = elem('-', sp.width, 1)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    16
      if(direction == 0)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    17
        (corner beside horizontalBar) above sp//(sp beside space)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    18
      else if (direction == 1)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    19
        sp beside (corner above verticalBar)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    20
      else if (direction == 2)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    21
        (space beside sp) above (horizontalBar beside corner)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    22
      else
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    23
        (verticalBar above corner) beside (space above sp)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    24
    }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    25
  }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    26
  val alphabet = ("""abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.:"=()\;-+*!<>\/%{} """+"\n\t").toSet//Set('a','b','c')
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    27
  def regx_tree(r: ARexp): Element = {
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    28
    r match {
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    29
      case APRED(bs, f) => {
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    30
        val Some(d) = alphabet.find(f)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    31
        d match {
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    32
          case '\n' => elem("\\n")
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    33
          case '\t' => elem("\\t")
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    34
          case ' ' => elem("space")
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    35
          case d => elem(d.toString)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    36
        }   
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    37
      }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    38
      case AONE(bs) => {
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    39
        elem("ONE")
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    40
      }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    41
      case AZERO => {
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    42
        elem("ZERO")
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    43
      }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    44
      case ASEQ(bs, r1, r2) => {
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    45
        binary_print("SEQ", r1, r2)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    46
      }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    47
      case AALTS(bs, rs) => {
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    48
        //elem("Awaiting completion")
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    49
        list_print("ALT", rs)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    50
      }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    51
      case ASTAR(bs, r) => {
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    52
        list_print("STA", List(r))
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    53
      }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    54
    }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    55
  }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    56
  val port = elem(" └-")
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    57
  def list_print(name: String, rs: List[ARexp]): Element = {
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    58
    rs match {
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    59
      case r::Nil => {
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    60
        val pref = regx_tree(r)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    61
        val head = elem(name)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    62
        (head left_align (port up_align pref) ) 
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    63
      }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    64
      case r2::r1::Nil => {
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    65
        binary_print(name, r2, r1)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    66
      }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    67
      case r::rs1 => {
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    68
        val pref = regx_tree(r)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    69
        val head = elem(name)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    70
        if (pref.height > 1){
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    71
          val link = elem('|', 1, pref.height - 1)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    72
          (head left_align ((port above link) beside pref)) left_align tail_print(rs1)    
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    73
        }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    74
        else{
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    75
          (head left_align (port beside pref) ) left_align tail_print(rs1)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    76
        }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    77
      }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    78
    }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    79
  }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    80
  def tail_print(rs: List[ARexp]): Element = {
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    81
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    82
    rs match {
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    83
      case r2::r1::Nil => {
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    84
        val pref = regx_tree(r2)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    85
        val suff = regx_tree(r1)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    86
        if (pref.height > 1){
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    87
          val link = elem('|', 1, pref.height - 1)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    88
          ((port above link) beside pref) left_align (port up_align suff)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    89
        }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    90
        else{
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    91
          (port beside pref) left_align (port up_align suff)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    92
        } 
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    93
      }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    94
      case r2::rs1 => {
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    95
        val pref = regx_tree(r2)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    96
        
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    97
        if (pref.height > 1){
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    98
          val link = elem('|', 1, pref.height - 1)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
    99
          ((port above link) beside pref) left_align tail_print(rs1)//(port up_align tail_print(rs1) )
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   100
        }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   101
        else{
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   102
          (port beside pref) left_align tail_print(rs1)//(port up_align tail_print(rs1))
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   103
        } 
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   104
        //pref left_align tail_print(rs1)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   105
      }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   106
    }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   107
  }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   108
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   109
  def binary_print(name: String, r1: ARexp, r2: ARexp): Element = {
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   110
    val pref = regx_tree(r1)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   111
    val suff = regx_tree(r2)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   112
    val head = elem(name)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   113
    if (pref.height > 1){
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   114
      val link = elem('|', 1, pref.height - 1)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   115
      (head left_align ((port above link) beside pref) ) left_align (port up_align suff)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   116
    }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   117
    else{
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   118
      (head left_align (port beside pref) ) left_align (port up_align suff)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   119
    }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   120
  }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   121
  def illustration(r: Rexp, s: String){
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   122
    var i_like_imperative_style = internalise(r)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   123
    val all_chars = s.toList
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   124
    for (i <- 0 to s.length - 1){
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   125
      val der_res =  bder(all_chars(i), i_like_imperative_style)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   126
      val simp_res = bsimp(der_res)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   127
      println("The three regxes are the original regex, the regex after derivative w.r.t " + all_chars(i) + " and the simplification of the derivative.")
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   128
      //println(regx_tree(i_like_imperative_style) up_align regx_tree(der_res) up_align regx_tree(simp_res))
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   129
      println(asize(i_like_imperative_style), asize(der_res), asize(simp_res))
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   130
      i_like_imperative_style = simp_res
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   131
    }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   132
  }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   133
  val ran = scala.util.Random
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   134
  var alphabet_size = 3
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   135
  def balanced_seq_star_gen(depth: Int, star: Boolean): Rexp = {
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   136
    if(depth == 1){
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   137
      ((ran.nextInt(6) + 97).toChar).toString
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   138
    }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   139
    else if(star){
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   140
      STAR(balanced_seq_star_gen(depth - 1, false))
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   141
    }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   142
    else{
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   143
      SEQ(balanced_seq_star_gen(depth - 1, true), balanced_seq_star_gen(depth - 1, true))
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   144
    }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   145
  }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   146
  def random_struct_gen(depth:Int): Rexp = {
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   147
    val dice = ran.nextInt(3)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   148
    (dice, depth) match {
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   149
      case (_, 0) => ((ran.nextInt(alphabet_size) + 97).toChar).toString
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   150
      case (0, i) => STAR(random_struct_gen(i - 1))
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   151
      case (1, i) => SEQ(random_struct_gen(i - 1), random_struct_gen(i - 1))
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   152
      case (2, i) => ALTS( List(random_struct_gen(i - 1), random_struct_gen(i - 1)) )
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   153
    }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   154
  }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   155
  def rd_string_gen(alp_size: Int, len: Int): String = {
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   156
    ((ran.nextInt(alp_size) + 97).toChar).toString + rd_string_gen(alp_size, len - 1)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   157
  }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   158
  //def stay_same_hpth(r: Rexp, )
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   159
  def main(args: Array[String]) {
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   160
    val depth = args(0).toInt
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   161
    alphabet_size = args(1).toInt
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   162
    //illustration(random_struct_gen(depth), rd_string_gen(alphabet_size, 20))//"abcabadaaadcabdbabcdaadbabbcbbdabdabbcbdbabdbcdb")
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   163
    for( i <- 50 to 400 by 20){
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   164
      println(i+" iterations of prog2:")
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   165
      blexing_simp(AWHILE_REGS, prog2 * i)
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   166
    }
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   167
      
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   168
  } 
82a99eec5b73 3 files to be compiled together and then run scala Spiral a b
Chengsong
parents:
diff changeset
   169
}