Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 1.17 KB | None | 0 0
  1. class TypeManger {
  2.     static HashMap<String, ClassInfo> classes;
  3.    
  4.     static ClassInfo get(String name) {
  5.         if the class has been loaded, return the reference,
  6.         else load it, store it, and return the reference
  7.     }
  8. }
  9. class ClassInfo {
  10.     String name;
  11.     String module;
  12.     ClassInfo superclass;
  13.     ClassInfo[] interfaces;
  14.     MethodInfo[] ctors;
  15.     MethodInfo[] dtors;
  16.     HashMap<String, ClassInfo> object_variables;
  17.     HashMap<String, ClassInfo> class_variables;
  18.     HashMap<String, MethodInfo> object_functions;
  19.     HashMap<String, MethodInfo> class_functions;
  20.     ArrayList<String> overloaded_variables;
  21.     ArrayList<String> overloaded_functions;
  22.     ArrayList<String>[] interface_method_implementations;
  23. }
  24. class MethodInfo {
  25.     String name;
  26.     ClassInfo returnType;
  27.     ClassInfo[] paramTypes;
  28.     String[] paramNames;
  29.     byte[] actual_code;
  30. }
  31.  
  32. class Program {
  33.     HashMap<String, ClassInfo> imported_classes;
  34.    
  35.     ClassInfo getImport(String name) {
  36.         if the class has been loaded, return the reference,
  37.         else load it, store it, and return the reference
  38.     }
  39.    
  40.     HashMap<String, ClassInfo> exported_classes;//the stuff defined in the file to be compiled
  41.    
  42.     ClassInfo getExport(String name) {
  43.         ...
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement