Advertisement
claukiller

dlp

Mar 13th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. parameters and local variables 1
  2. el resto 0
  3.  
  4. acabar typechecking
  5.  
  6. ------- clase anterior -------------
  7. visitor TP TR
  8. visit(Arith,TP) : TR
  9.  
  10. (astnode)
  11. <TP , TR> aceept (visitor, tp)
  12.  
  13. override accept en todas las clases
  14.  
  15. accept -> return visitor.visit(this);
  16.  
  17. visit en concrete types (como recorfield)
  18.  
  19.  
  20. accept en ast y override en todas e interfaz del visitor con los ACEPPTS
  21. typecheckingvisitor implemenets visitor lvalue
  22.  
  23.  
  24. a expression le metemos set lvalue boolean y getlvalue
  25.  
  26. visit (Arith a, Void v)
  27. a.getOP1().accept(this);
  28. a.getOP2().accept(this);
  29. a.setLvalue(false);
  30.  
  31. visit (Variable v, Void i)
  32. v.setlvalue(true);
  33.  
  34. visit (Assigment a, void i){
  35. a.left.accept(this,v)
  36. a.right.aceept(this,v)
  37. if (!a.left.lvalue = true)?
  38. new error
  39. }
  40.  
  41.  
  42. cambiar lista de dis por variabke
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement