Compilerbauhome Compilerbau: Codeerzeugung für Ausdrücke Prof. Dr. Uwe Schmidt FH Wedel

Codeerzeugung für Ausdrücke


weiter

Ausdrücke: Das Testprogramm: ppl/examples/expr.ppl

   1begin
   2  var
   3   ijk : int
   4           := 1, 2, 3;
   5   
   6   -- simple integer arithmetic
   7   
   8   i := -i +j -1 + j * k div (i mod 3);
   9   ij := i max j max ki min j min k;
  10
  11   -- simple floating point arithmetic
  12   
  13   begin
  14     var
  15      xyz : float
  16              := 1.0, -2.0, +3.0;
  17      
  18      x := -x * y + (z - y) / x * y
  19   end;
  20
  21   -- boolean and relational operators
  22   
  23   begin
  24     var
  25      abc : boolean
  26              := truefalsefalse;
  27
  28      a := (i < jand (j <= kor b or not c;
  29      a := b => c;
  30      a := b <=> a and c
  31   end;
  32
  33   -- string expressions
  34   
  35   begin
  36     var
  37      s1s2 : string
  38             := "hello""world";
  39
  40      s1 := s1 + s2 + "\"" + i.toString + "\"";
  41
  42      write(s1);
  43      writeln(s2)
  44   end;
  45
  46   -- list operations
  47   
  48   begin
  49     var
  50      l1l2 : list of int
  51             := [0, 1, 1, 2, 3, 5, 8, 13], [];
  52
  53      l2 := l2.append(42)
  54              .append(43);
  55
  56      if l2.empty
  57      then
  58         l2 := [1, 2, 3]
  59      endif;
  60      
  61      l1 := l1.cons(41);
  62      
  63      l1 := l1 + l2 + l1;
  64      
  65      l1 := l1.tail
  66              .cons(l1.head)
  67              .cons(l1[i])
  68              .append(l1[l1.length -1])
  69   end;
  70
  71   -- picture operations
  72   
  73   begin
  74     var
  75      p1p2p3  : picture;
  76
  77      -- new pictures
  78      
  79      p1 := white(100,200);
  80      p2 := grey(0.5, p1.widthp1.height);
  81      p3 := black(100,200);
  82
  83      -- flip and gamma corrections
  84      
  85      p2 := p2.flipVertical
  86              .flipHorizontal
  87              .gamma(1.5);
  88
  89      -- same as above with funtional syntax
  90      
  91      p2 := gamma(flipHorizontal(flipVertical(p2)),
  92                  1.5);
  93
  94      -- load a picture
  95      
  96      p2 := load("t.pgm");
  97
  98      -- make negative picture
  99      
 100      p1 := p2.invert;
 101
 102      -- combine 2 pictures
 103      
 104      p2 := above(sideBySide(p1,p2),
 105                  sideBySide(p2,p1));
 106
 107      -- pixelwise arithmetic mean of grey values
 108      
 109      p2 := p1 + p2;
 110
 111      -- pixelwise difference of grey values
 112      
 113      p2 := p1 - p2;
 114
 115      -- pixelwise min and max operations
 116      
 117      p1 := p1 max p2 min p3;
 118
 119      -- store pictures
 120
 121      store(p1,"p1.pgm");
 122      
 123      p2.store("p2.pgm")
 124      
 125   end;
 126
 127   -- get command line  arguments
 128   begin
 129     var
 130      ls1 : list of string
 131      -- not yet implemented: ls1 := getargs()
 132   end
 133   
 134end
weiter

weiter

Ausdrücke: Der attributierte Programmbaum: ppl/examples/expr.check

   1---"sequence" (VoidType)
   2   |
   3   +---"begin" (VoidType)
   4       |
   5       +---"sequence" (VoidType)
   6           |
   7           +---"decl" (VoidType)
   8           |   |
   9           |   +---"id" i (IntType)
  10           |
  11           +---"decl" (VoidType)
  12           |   |
  13           |   +---"id" j (IntType)
  14           |
  15           +---"decl" (VoidType)
  16           |   |
  17           |   +---"id" k (IntType)
  18           |
  19           +---":=" (VoidType)
  20           |   |
  21           |   +---"id" i (IntType)
  22           |   |
  23           |   +---"id" j (IntType)
  24           |   |
  25           |   +---"id" k (IntType)
  26           |   |
  27           |   +---(IntType)
  28           |   |
  29           |   +---(IntType)
  30           |   |
  31           |   +---(IntType)
  32           |
  33           +---":=" (VoidType)
  34           |   |
  35           |   +---"id" i (IntType)
  36           |   |
  37           |   +---"addi" (IntType)
  38           |       |
  39           |       +---"subi" (IntType)
  40           |       |   |
  41           |       |   +---"addi" (IntType)
  42           |       |   |   |
  43           |       |   |   +---"negi" (IntType)
  44           |       |   |   |   |
  45           |       |   |   |   +---"id" i (IntType)
  46           |       |   |   |
  47           |       |   |   +---"id" j (IntType)
  48           |       |   |
  49           |       |   +---(IntType)
  50           |       |
  51           |       +---"divi" (IntType)
  52           |           |
  53           |           +---"muli" (IntType)
  54           |           |   |
  55           |           |   +---"id" j (IntType)
  56           |           |   |
  57           |           |   +---"id" k (IntType)
  58           |           |
  59           |           +---"modi" (IntType)
  60           |               |
  61           |               +---"id" i (IntType)
  62           |               |
  63           |               +---(IntType)
  64           |
  65           +---":=" (VoidType)
  66           |   |
  67           |   +---"id" i (IntType)
  68           |   |
  69           |   +---"id" j (IntType)
  70           |   |
  71           |   +---"maxi" (IntType)
  72           |   |   |
  73           |   |   +---"maxi" (IntType)
  74           |   |   |   |
  75           |   |   |   +---"id" i (IntType)
  76           |   |   |   |
  77           |   |   |   +---"id" j (IntType)
  78           |   |   |
  79           |   |   +---"id" k (IntType)
  80           |   |
  81           |   +---"mini" (IntType)
  82           |       |
  83           |       +---"mini" (IntType)
  84           |       |   |
  85           |       |   +---"id" i (IntType)
  86           |       |   |
  87           |       |   +---"id" j (IntType)
  88           |       |
  89           |       +---"id" k (IntType)
  90           |
  91           +---"begin" (VoidType)
  92           |   |
  93           |   +---"sequence" (VoidType)
  94           |       |
  95           |       +---"decl" (VoidType)
  96           |       |   |
  97           |       |   +---"id" x (FloatType)
  98           |       |
  99           |       +---"decl" (VoidType)
 100           |       |   |
 101           |       |   +---"id" y (FloatType)
 102           |       |
 103           |       +---"decl" (VoidType)
 104           |       |   |
 105           |       |   +---"id" z (FloatType)
 106           |       |
 107           |       +---":=" (VoidType)
 108           |       |   |
 109           |       |   +---"id" x (FloatType)
 110           |       |   |
 111           |       |   +---"id" y (FloatType)
 112           |       |   |
 113           |       |   +---"id" z (FloatType)
 114           |       |   |
 115           |       |   +---1.0 (FloatType)
 116           |       |   |
 117           |       |   +---"negf" (FloatType)
 118           |       |   |   |
 119           |       |   |   +---2.0 (FloatType)
 120           |       |   |
 121           |       |   +---"ident" (FloatType)
 122           |       |       |
 123           |       |       +---3.0 (FloatType)
 124           |       |
 125           |       +---":=" (VoidType)
 126           |       |   |
 127           |       |   +---"id" x (FloatType)
 128           |       |   |
 129           |       |   +---"addf" (FloatType)
 130           |       |       |
 131           |       |       +---"mulf" (FloatType)
 132           |       |       |   |
 133           |       |       |   +---"negf" (FloatType)
 134           |       |       |   |   |
 135           |       |       |   |   +---"id" x (FloatType)
 136           |       |       |   |
 137           |       |       |   +---"id" y (FloatType)
 138           |       |       |
 139           |       |       +---"mulf" (FloatType)
 140           |       |           |
 141           |       |           +---"divf" (FloatType)
 142           |       |           |   |
 143           |       |           |   +---"subf" (FloatType)
 144           |       |           |   |   |
 145           |       |           |   |   +---"id" z (FloatType)
 146           |       |           |   |   |
 147           |       |           |   |   +---"id" y (FloatType)
 148           |       |           |   |
 149           |       |           |   +---"id" x (FloatType)
 150           |       |           |
 151           |       |           +---"id" y (FloatType)
 152           |       |
 153           |       +---":=" (VoidType)
 154           |       |   |
 155           |       |   +---"id" x (FloatType)
 156           |       |   |
 157           |       |   +---UndefVal (FloatType)
 158           |       |
 159           |       +---":=" (VoidType)
 160           |       |   |
 161           |       |   +---"id" y (FloatType)
 162           |       |   |
 163           |       |   +---UndefVal (FloatType)
 164           |       |
 165           |       +---":=" (VoidType)
 166           |           |
 167           |           +---"id" z (FloatType)
 168           |           |
 169           |           +---UndefVal (FloatType)
 170           |
 171           +---"begin" (VoidType)
 172           |   |
 173           |   +---"sequence" (VoidType)
 174           |       |
 175           |       +---"decl" (VoidType)
 176           |       |   |
 177           |       |   +---"id" a (BoolType)
 178           |       |
 179           |       +---"decl" (VoidType)
 180           |       |   |
 181           |       |   +---"id" b (BoolType)
 182           |       |
 183           |       +---"decl" (VoidType)
 184           |       |   |
 185           |       |   +---"id" c (BoolType)
 186           |       |
 187           |       +---":=" (VoidType)
 188           |       |   |
 189           |       |   +---"id" a (BoolType)
 190           |       |   |
 191           |       |   +---"id" b (BoolType)
 192           |       |   |
 193           |       |   +---"id" c (BoolType)
 194           |       |   |
 195           |       |   +---True (BoolType)
 196           |       |   |
 197           |       |   +---False (BoolType)
 198           |       |   |
 199           |       |   +---False (BoolType)
 200           |       |
 201           |       +---":=" (VoidType)
 202           |       |   |
 203           |       |   +---"id" a (BoolType)
 204           |       |   |
 205           |       |   +---"or" (BoolType)
 206           |       |       |
 207           |       |       +---"or" (BoolType)
 208           |       |       |   |
 209           |       |       |   +---"and" (BoolType)
 210           |       |       |   |   |
 211           |       |       |   |   +---"lti" (BoolType)
 212           |       |       |   |   |   |
 213           |       |       |   |   |   +---"id" i (IntType)
 214           |       |       |   |   |   |
 215           |       |       |   |   |   +---"id" j (IntType)
 216           |       |       |   |   |
 217           |       |       |   |   +---"lei" (BoolType)
 218           |       |       |   |       |
 219           |       |       |   |       +---"id" j (IntType)
 220           |       |       |   |       |
 221           |       |       |   |       +---"id" k (IntType)
 222           |       |       |   |
 223           |       |       |   +---"id" b (BoolType)
 224           |       |       |
 225           |       |       +---"not" (BoolType)
 226           |       |           |
 227           |       |           +---"id" c (BoolType)
 228           |       |
 229           |       +---":=" (VoidType)
 230           |       |   |
 231           |       |   +---"id" a (BoolType)
 232           |       |   |
 233           |       |   +---"impl" (BoolType)
 234           |       |       |
 235           |       |       +---"id" b (BoolType)
 236           |       |       |
 237           |       |       +---"id" c (BoolType)
 238           |       |
 239           |       +---":=" (VoidType)
 240           |       |   |
 241           |       |   +---"id" a (BoolType)
 242           |       |   |
 243           |       |   +---"equiv" (BoolType)
 244           |       |       |
 245           |       |       +---"id" b (BoolType)
 246           |       |       |
 247           |       |       +---"and" (BoolType)
 248           |       |           |
 249           |       |           +---"id" a (BoolType)
 250           |       |           |
 251           |       |           +---"id" c (BoolType)
 252           |       |
 253           |       +---":=" (VoidType)
 254           |       |   |
 255           |       |   +---"id" a (BoolType)
 256           |       |   |
 257           |       |   +---UndefVal (BoolType)
 258           |       |
 259           |       +---":=" (VoidType)
 260           |       |   |
 261           |       |   +---"id" b (BoolType)
 262           |       |   |
 263           |       |   +---UndefVal (BoolType)
 264           |       |
 265           |       +---":=" (VoidType)
 266           |           |
 267           |           +---"id" c (BoolType)
 268           |           |
 269           |           +---UndefVal (BoolType)
 270           |
 271           +---"begin" (VoidType)
 272           |   |
 273           |   +---"sequence" (VoidType)
 274           |       |
 275           |       +---"decl" (VoidType)
 276           |       |   |
 277           |       |   +---"id" s1 (StringType)
 278           |       |
 279           |       +---"decl" (VoidType)
 280           |       |   |
 281           |       |   +---"id" s2 (StringType)
 282           |       |
 283           |       +---":=" (VoidType)
 284           |       |   |
 285           |       |   +---"id" s1 (StringType)
 286           |       |   |
 287           |       |   +---"id" s2 (StringType)
 288           |       |   |
 289           |       |   +---""hello"" (StringType)
 290           |       |   |
 291           |       |   +---""world"" (StringType)
 292           |       |
 293           |       +---":=" (VoidType)
 294           |       |   |
 295           |       |   +---"id" s1 (StringType)
 296           |       |   |
 297           |       |   +---"concs" (StringType)
 298           |       |       |
 299           |       |       +---"concs" (StringType)
 300           |       |       |   |
 301           |       |       |   +---"concs" (StringType)
 302           |       |       |   |   |
 303           |       |       |   |   +---"concs" (StringType)
 304           |       |       |   |   |   |
 305           |       |       |   |   |   +---"id" s1 (StringType)
 306           |       |       |   |   |   |
 307           |       |       |   |   |   +---"id" s2 (StringType)
 308           |       |       |   |   |
 309           |       |       |   |   +---""\""(StringType)
 310           |       |       |   |
 311           |       |       |   +---"i2s" (StringType)
 312           |       |       |       |
 313           |       |       |       +---"id" i (IntType)
 314           |       |       |
 315           |       |       +---""\""(StringType)
 316           |       |
 317           |       +---"do" (VoidType)
 318           |       |   |
 319           |       |   +---"write" (VoidType)
 320           |       |       |
 321           |       |       +---"id" s1 (StringType)
 322           |       |
 323           |       +---"do" (VoidType)
 324           |       |   |
 325           |       |   +---"writeln" (VoidType)
 326           |       |       |
 327           |       |       +---"id" s2 (StringType)
 328           |       |
 329           |       +---":=" (VoidType)
 330           |       |   |
 331           |       |   +---"id" s1 (StringType)
 332           |       |   |
 333           |       |   +---UndefVal (StringType)
 334           |       |
 335           |       +---":=" (VoidType)
 336           |           |
 337           |           +---"id" s2 (StringType)
 338           |           |
 339           |           +---UndefVal (StringType)
 340           |
 341           +---"begin" (VoidType)
 342           |   |
 343           |   +---"sequence" (VoidType)
 344           |       |
 345           |       +---"decl" (VoidType)
 346           |       |   |
 347           |       |   +---"id" l1 (ListType IntType)
 348           |       |
 349           |       +---"decl" (VoidType)
 350           |       |   |
 351           |       |   +---"id" l2 (ListType IntType)
 352           |       |
 353           |       +---":=" (VoidType)
 354           |       |   |
 355           |       |   +---"id" l1 (ListType IntType)
 356           |       |   |
 357           |       |   +---"id" l2 (ListType IntType)
 358           |       |   |
 359           |       |   +---"consl" (ListType IntType)
 360           |       |   |   |
 361           |       |   |   +---"consl" (ListType IntType)
 362           |       |   |   |   |
 363           |       |   |   |   +---"consl" (ListType IntType)
 364           |       |   |   |   |   |
 365           |       |   |   |   |   +---"consl" (ListType IntType)
 366           |       |   |   |   |   |   |
 367           |       |   |   |   |   |   +---"consl" (ListType IntType)
 368           |       |   |   |   |   |   |   |
 369           |       |   |   |   |   |   |   +---"consl" (ListType IntType)
 370           |       |   |   |   |   |   |   |   |
 371           |       |   |   |   |   |   |   |   +---"consl" (ListType IntType)
 372           |       |   |   |   |   |   |   |   |   |
 373           |       |   |   |   |   |   |   |   |   +---"consl" (ListType IntType)
 374           |       |   |   |   |   |   |   |   |   |   |
 375           |       |   |   |   |   |   |   |   |   |   +---[] (ListType IntType)
 376           |       |   |   |   |   |   |   |   |   |   |
 377           |       |   |   |   |   |   |   |   |   |   +---13 (IntType)
 378           |       |   |   |   |   |   |   |   |   |
 379           |       |   |   |   |   |   |   |   |   +---(IntType)
 380           |       |   |   |   |   |   |   |   |
 381           |       |   |   |   |   |   |   |   +---(IntType)
 382           |       |   |   |   |   |   |   |
 383           |       |   |   |   |   |   |   +---(IntType)
 384           |       |   |   |   |   |   |
 385           |       |   |   |   |   |   +---(IntType)
 386           |       |   |   |   |   |
 387           |       |   |   |   |   +---(IntType)
 388           |       |   |   |   |
 389           |       |   |   |   +---(IntType)
 390           |       |   |   |
 391           |       |   |   +---(IntType)
 392           |       |   |
 393           |       |   +---[] (ListType IntType)
 394           |       |
 395           |       +---":=" (VoidType)
 396           |       |   |
 397           |       |   +---"id" l2 (ListType IntType)
 398           |       |   |
 399           |       |   +---"appendl" (ListType IntType)
 400           |       |       |
 401           |       |       +---"appendl" (ListType IntType)
 402           |       |       |   |
 403           |       |       |   +---"id" l2 (ListType IntType)
 404           |       |       |   |
 405           |       |       |   +---42 (IntType)
 406           |       |       |
 407           |       |       +---43 (IntType)
 408           |       |
 409           |       +---"if" (VoidType)
 410           |       |   |
 411           |       |   +---"isemptyl" (BoolType)
 412           |       |   |   |
 413           |       |   |   +---"id" l2 (ListType IntType)
 414           |       |   |
 415           |       |   +---"begin" (VoidType)
 416           |       |   |   |
 417           |       |   |   +---"sequence" (VoidType)
 418           |       |   |       |
 419           |       |   |       +---":=" (VoidType)
 420           |       |   |           |
 421           |       |   |           +---"id" l2 (ListType IntType)
 422           |       |   |           |
 423           |       |   |           +---"consl" (ListType IntType)
 424           |       |   |               |
 425           |       |   |               +---"consl" (ListType IntType)
 426           |       |   |               |   |
 427           |       |   |               |   +---"consl" (ListType IntType)
 428           |       |   |               |   |   |
 429           |       |   |               |   |   +---[] (ListType IntType)
 430           |       |   |               |   |   |
 431           |       |   |               |   |   +---(IntType)
 432           |       |   |               |   |
 433           |       |   |               |   +---(IntType)
 434           |       |   |               |
 435           |       |   |               +---(IntType)
 436           |       |   |
 437           |       |   +---"begin" (VoidType)
 438           |       |       |
 439           |       |       +---"sequence" (VoidType)
 440           |       |
 441           |       +---":=" (VoidType)
 442           |       |   |
 443           |       |   +---"id" l1 (ListType IntType)
 444           |       |   |
 445           |       |   +---"consl" (ListType IntType)
 446           |       |       |
 447           |       |       +---"id" l1 (ListType IntType)
 448           |       |       |
 449           |       |       +---41 (IntType)
 450           |       |
 451           |       +---":=" (VoidType)
 452           |       |   |
 453           |       |   +---"id" l1 (ListType IntType)
 454           |       |   |
 455           |       |   +---"concl" (ListType IntType)
 456           |       |       |
 457           |       |       +---"concl" (ListType IntType)
 458           |       |       |   |
 459           |       |       |   +---"id" l1 (ListType IntType)
 460           |       |       |   |
 461           |       |       |   +---"id" l2 (ListType IntType)
 462           |       |       |
 463           |       |       +---"id" l1 (ListType IntType)
 464           |       |
 465           |       +---":=" (VoidType)
 466           |       |   |
 467           |       |   +---"id" l1 (ListType IntType)
 468           |       |   |
 469           |       |   +---"appendl" (ListType IntType)
 470           |       |       |
 471           |       |       +---"consl" (ListType IntType)
 472           |       |       |   |
 473           |       |       |   +---"consl" (ListType IntType)
 474           |       |       |   |   |
 475           |       |       |   |   +---"taill" (ListType IntType)
 476           |       |       |   |   |   |
 477           |       |       |   |   |   +---"id" l1 (ListType IntType)
 478           |       |       |   |   |
 479           |       |       |   |   +---"headl" (IntType)
 480           |       |       |   |       |
 481           |       |       |   |       +---"id" l1 (ListType IntType)
 482           |       |       |   |
 483           |       |       |   +---"indexl" (IntType)
 484           |       |       |       |
 485           |       |       |       +---"id" l1 (ListType IntType)
 486           |       |       |       |
 487           |       |       |       +---"id" i (IntType)
 488           |       |       |
 489           |       |       +---"indexl" (IntType)
 490           |       |           |
 491           |       |           +---"id" l1 (ListType IntType)
 492           |       |           |
 493           |       |           +---"subi" (IntType)
 494           |       |               |
 495           |       |               +---"lengthl" (IntType)
 496           |       |               |   |
 497           |       |               |   +---"id" l1 (ListType IntType)
 498           |       |               |
 499           |       |               +---(IntType)
 500           |       |
 501           |       +---":=" (VoidType)
 502           |       |   |
 503           |       |   +---"id" l1 (ListType IntType)
 504           |       |   |
 505           |       |   +---UndefVal (ListType IntType)
 506           |       |
 507           |       +---":=" (VoidType)
 508           |           |
 509           |           +---"id" l2 (ListType IntType)
 510           |           |
 511           |           +---UndefVal (ListType IntType)
 512           |
 513           +---"begin" (VoidType)
 514           |   |
 515           |   +---"sequence" (VoidType)
 516           |       |
 517           |       +---"decl" (VoidType)
 518           |       |   |
 519           |       |   +---"id" p1 (PictureType)
 520           |       |
 521           |       +---"decl" (VoidType)
 522           |       |   |
 523           |       |   +---"id" p2 (PictureType)
 524           |       |
 525           |       +---"decl" (VoidType)
 526           |       |   |
 527           |       |   +---"id" p3 (PictureType)
 528           |       |
 529           |       +---":=" (VoidType)
 530           |       |   |
 531           |       |   +---"id" p1 (PictureType)
 532           |       |   |
 533           |       |   +---"white" (PictureType)
 534           |       |       |
 535           |       |       +---100 (IntType)
 536           |       |       |
 537           |       |       +---200 (IntType)
 538           |       |
 539           |       +---":=" (VoidType)
 540           |       |   |
 541           |       |   +---"id" p2 (PictureType)
 542           |       |   |
 543           |       |   +---"grey" (PictureType)
 544           |       |       |
 545           |       |       +---0.5 (FloatType)
 546           |       |       |
 547           |       |       +---"width" (IntType)
 548           |       |       |   |
 549           |       |       |   +---"id" p1 (PictureType)
 550           |       |       |
 551           |       |       +---"height" (IntType)
 552           |       |           |
 553           |       |           +---"id" p1 (PictureType)
 554           |       |
 555           |       +---":=" (VoidType)
 556           |       |   |
 557           |       |   +---"id" p3 (PictureType)
 558           |       |   |
 559           |       |   +---"black" (PictureType)
 560           |       |       |
 561           |       |       +---100 (IntType)
 562           |       |       |
 563           |       |       +---200 (IntType)
 564           |       |
 565           |       +---":=" (VoidType)
 566           |       |   |
 567           |       |   +---"id" p2 (PictureType)
 568           |       |   |
 569           |       |   +---"gamma" (PictureType)
 570           |       |       |
 571           |       |       +---"flipHorizontal" (PictureType)
 572           |       |       |   |
 573           |       |       |   +---"flipVertical" (PictureType)
 574           |       |       |       |
 575           |       |       |       +---"id" p2 (PictureType)
 576           |       |       |
 577           |       |       +---1.5 (FloatType)
 578           |       |
 579           |       +---":=" (VoidType)
 580           |       |   |
 581           |       |   +---"id" p2 (PictureType)
 582           |       |   |
 583           |       |   +---"gamma" (PictureType)
 584           |       |       |
 585           |       |       +---"flipHorizontal" (PictureType)
 586           |       |       |   |
 587           |       |       |   +---"flipVertical" (PictureType)
 588           |       |       |       |
 589           |       |       |       +---"id" p2 (PictureType)
 590           |       |       |
 591           |       |       +---1.5 (FloatType)
 592           |       |
 593           |       +---":=" (VoidType)
 594           |       |   |
 595           |       |   +---"id" p2 (PictureType)
 596           |       |   |
 597           |       |   +---"load" (PictureType)
 598           |       |       |
 599           |       |       +---""t.pgm"" (StringType)
 600           |       |
 601           |       +---":=" (VoidType)
 602           |       |   |
 603           |       |   +---"id" p1 (PictureType)
 604           |       |   |
 605           |       |   +---"invert" (PictureType)
 606           |       |       |
 607           |       |       +---"id" p2 (PictureType)
 608           |       |
 609           |       +---":=" (VoidType)
 610           |       |   |
 611           |       |   +---"id" p2 (PictureType)
 612           |       |   |
 613           |       |   +---"above" (PictureType)
 614           |       |       |
 615           |       |       +---"sideBySide" (PictureType)
 616           |       |       |   |
 617           |       |       |   +---"id" p1 (PictureType)
 618           |       |       |   |
 619           |       |       |   +---"id" p2 (PictureType)
 620           |       |       |
 621           |       |       +---"sideBySide" (PictureType)
 622           |       |           |
 623           |       |           +---"id" p2 (PictureType)
 624           |       |           |
 625           |       |           +---"id" p1 (PictureType)
 626           |       |
 627           |       +---":=" (VoidType)
 628           |       |   |
 629           |       |   +---"id" p2 (PictureType)
 630           |       |   |
 631           |       |   +---"mean" (PictureType)
 632           |       |       |
 633           |       |       +---"id" p1 (PictureType)
 634           |       |       |
 635           |       |       +---"id" p2 (PictureType)
 636           |       |
 637           |       +---":=" (VoidType)
 638           |       |   |
 639           |       |   +---"id" p2 (PictureType)
 640           |       |   |
 641           |       |   +---"diff" (PictureType)
 642           |       |       |
 643           |       |       +---"id" p1 (PictureType)
 644           |       |       |
 645           |       |       +---"id" p2 (PictureType)
 646           |       |
 647           |       +---":=" (VoidType)
 648           |       |   |
 649           |       |   +---"id" p1 (PictureType)
 650           |       |   |
 651           |       |   +---"minp" (PictureType)
 652           |       |       |
 653           |       |       +---"maxp" (PictureType)
 654           |       |       |   |
 655           |       |       |   +---"id" p1 (PictureType)
 656           |       |       |   |
 657           |       |       |   +---"id" p2 (PictureType)
 658           |       |       |
 659           |       |       +---"id" p3 (PictureType)
 660           |       |
 661           |       +---"do" (VoidType)
 662           |       |   |
 663           |       |   +---"store" (VoidType)
 664           |       |       |
 665           |       |       +---"id" p1 (PictureType)
 666           |       |       |
 667           |       |       +---""p1.pgm"" (StringType)
 668           |       |
 669           |       +---"do" (VoidType)
 670           |       |   |
 671           |       |   +---"store" (VoidType)
 672           |       |       |
 673           |       |       +---"id" p2 (PictureType)
 674           |       |       |
 675           |       |       +---""p2.pgm"" (StringType)
 676           |       |
 677           |       +---":=" (VoidType)
 678           |       |   |
 679           |       |   +---"id" p1 (PictureType)
 680           |       |   |
 681           |       |   +---UndefVal (PictureType)
 682           |       |
 683           |       +---":=" (VoidType)
 684           |       |   |
 685           |       |   +---"id" p2 (PictureType)
 686           |       |   |
 687           |       |   +---UndefVal (PictureType)
 688           |       |
 689           |       +---":=" (VoidType)
 690           |           |
 691           |           +---"id" p3 (PictureType)
 692           |           |
 693           |           +---UndefVal (PictureType)
 694           |
 695           +---"begin" (VoidType)
 696           |   |
 697           |   +---"sequence" (VoidType)
 698           |       |
 699           |       +---"decl" (VoidType)
 700           |       |   |
 701           |       |   +---"id" ls1 (ListType StringType)
 702           |       |
 703           |       +---":=" (VoidType)
 704           |           |
 705           |           +---"id" ls1 (ListType StringType)
 706           |           |
 707           |           +---UndefVal (ListType StringType)
 708           |
 709           +---":=" (VoidType)
 710           |   |
 711           |   +---"id" i (IntType)
 712           |   |
 713           |   +---UndefVal (IntType)
 714           |
 715           +---":=" (VoidType)
 716           |   |
 717           |   +---"id" j (IntType)
 718           |   |
 719           |   +---UndefVal (IntType)
 720           |
 721           +---":=" (VoidType)
 722               |
 723               +---"id" k (IntType)
 724               |
 725               +---UndefVal (IntType)
weiter

weiter

Ausdrücke: Der Assemblercode: ppl/examples/expr.gencode

   1.text
   2        loadi   1
   3        loadi   2
   4        loadi   3
   5        store   m[2]
   6        store   m[1]
   7        store   m[0]
   8        loadi   0
   9        load    m[0]
  10        subi
  11        load    m[1]
  12        addi
  13        loadi   1
  14        subi
  15        load    m[1]
  16        load    m[2]
  17        muli
  18        load    m[0]
  19        loadi   3
  20        modi
  21        divi
  22        addi
  23        store   m[0]
  24        load    m[0]
  25        load    m[1]
  26        maxi
  27        load    m[2]
  28        maxi
  29        load    m[0]
  30        load    m[1]
  31        mini
  32        load    m[2]
  33        mini
  34        store   m[1]
  35        store   m[0]
  36        loadf   1.0
  37        loadf   -2.0
  38        loadf   3.0
  39        store   m[5]
  40        store   m[4]
  41        store   m[3]
  42        loadf   0.0
  43        load    m[3]
  44        subf
  45        load    m[4]
  46        mulf
  47        load    m[5]
  48        load    m[4]
  49        subf
  50        load    m[3]
  51        divf
  52        load    m[4]
  53        mulf
  54        addf
  55        store   m[3]
  56        undef
  57        store   m[3]
  58        undef
  59        store   m[4]
  60        undef
  61        store   m[5]
  62        loadi   1
  63        loadi   0
  64        loadi   0
  65        store   m[5]
  66        store   m[4]
  67        store   m[3]
  68        load    m[1]
  69        load    m[0]
  70        gti
  71        brfalse l3
  72        load    m[2]
  73        load    m[1]
  74        gei
  75        brtrue  l2
  76l3:
  77        load    m[4]
  78        brfalse l0
  79l2:
  80        loadi   1
  81        jmp     l1
  82l0:
  83        loadi   1
  84        load    m[5]
  85        subi
  86l1:
  87        store   m[3]
  88        load    m[4]
  89        brfalse l4
  90        load    m[5]
  91        jmp     l5
  92l4:
  93        loadi   1
  94l5:
  95        store   m[3]
  96        load    m[4]
  97        load    m[3]
  98        brfalse l6
  99        load    m[5]
 100        jmp     l7
 101l6:
 102        loadi   0
 103l7:
 104        eqi
 105        store   m[3]
 106        undef
 107        store   m[3]
 108        undef
 109        store   m[4]
 110        undef
 111        store   m[5]
 112        loads   "hello"
 113        loads   "world"
 114        store   m[4]
 115        store   m[3]
 116        load    m[3]
 117        load    m[4]
 118        concs
 119        loads   "\""
 120        concs
 121        load    m[0]
 122        i2s
 123        concs
 124        loads   "\""
 125        concs
 126        store   m[3]
 127        load    m[3]
 128        svc     write
 129        pop
 130        load    m[4]
 131        svc     writeln
 132        pop
 133        undef
 134        store   m[3]
 135        undef
 136        store   m[4]
 137        emptyl
 138        loadi   13
 139        consl
 140        loadi   8
 141        consl
 142        loadi   5
 143        consl
 144        loadi   3
 145        consl
 146        loadi   2
 147        consl
 148        loadi   1
 149        consl
 150        loadi   1
 151        consl
 152        loadi   0
 153        consl
 154        emptyl
 155        store   m[4]
 156        store   m[3]
 157        load    m[4]
 158        loadi   42
 159        appendl
 160        loadi   43
 161        appendl
 162        store   m[4]
 163        load    m[4]
 164        isemptyl
 165        brfalse l8
 166        emptyl
 167        loadi   3
 168        consl
 169        loadi   2
 170        consl
 171        loadi   1
 172        consl
 173        store   m[4]
 174l8:
 175        load    m[3]
 176        loadi   41
 177        consl
 178        store   m[3]
 179        load    m[3]
 180        load    m[4]
 181        concl
 182        load    m[3]
 183        concl
 184        store   m[3]
 185        load    m[3]
 186        taill
 187        load    m[3]
 188        loadi   0
 189        indexl
 190        consl
 191        load    m[3]
 192        load    m[0]
 193        indexl
 194        consl
 195        load    m[3]
 196        load    m[3]
 197        lengthl
 198        loadi   1
 199        subi
 200        indexl
 201        appendl
 202        store   m[3]
 203        undef
 204        store   m[3]
 205        undef
 206        store   m[4]
 207        loadi   100
 208        loadi   200
 209        white
 210        store   m[3]
 211        loadf   0.5
 212        load    m[3]
 213        width
 214        load    m[3]
 215        height
 216        grey
 217        store   m[4]
 218        loadi   100
 219        loadi   200
 220        black
 221        store   m[5]
 222        load    m[4]
 223        flipVertical
 224        flipHorizontal
 225        loadf   1.5
 226        gamma
 227        store   m[4]
 228        load    m[4]
 229        flipVertical
 230        flipHorizontal
 231        loadf   1.5
 232        gamma
 233        store   m[4]
 234        loads   "t.pgm"
 235        svc     load
 236        store   m[4]
 237        load    m[4]
 238        invert
 239        store   m[3]
 240        load    m[3]
 241        load    m[4]
 242        sideBySide
 243        load    m[4]
 244        load    m[3]
 245        sideBySide
 246        above
 247        store   m[4]
 248        load    m[3]
 249        load    m[4]
 250        mean
 251        store   m[4]
 252        load    m[3]
 253        load    m[4]
 254        diff
 255        store   m[4]
 256        load    m[3]
 257        load    m[4]
 258        maxp
 259        load    m[5]
 260        minp
 261        store   m[3]
 262        load    m[3]
 263        loads   "p1.pgm"
 264        svc     store
 265        pop
 266        load    m[4]
 267        loads   "p2.pgm"
 268        svc     store
 269        pop
 270        undef
 271        store   m[3]
 272        undef
 273        store   m[4]
 274        undef
 275        store   m[5]
 276        undef
 277        store   m[3]
 278        undef
 279        store   m[0]
 280        undef
 281        store   m[1]
 282        undef
 283        store   m[2]
 284        terminate
 285
 286.data   6
weiter

Letzte Änderung: 14.02.2012
© Prof. Dr. Uwe Schmidt
Prof. Dr. Uwe Schmidt FH Wedel