/src/tools/compiler/liberty_compiler.e

http://github.com/tybor/Liberty · Specman e · 95 lines · 62 code · 16 blank · 17 comment · 1 complexity · 9697d9f446de8d6c042ba33e16b1c6ff MD5 · raw file

  1. -- This file is part of Liberty Eiffel.
  2. --
  3. -- Liberty Eiffel is free software: you can redistribute it and/or modify
  4. -- it under the terms of the GNU General Public License as published by
  5. -- the Free Software Foundation, version 3 of the License.
  6. --
  7. -- Liberty Eiffel is distributed in the hope that it will be useful,
  8. -- but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. -- GNU General Public License for more details.
  11. --
  12. -- You should have received a copy of the GNU General Public License
  13. -- along with Liberty Eiffel. If not, see <http://www.gnu.org/licenses/>.
  14. --
  15. class LIBERTY_COMPILER
  16. create {LIBERTYC}
  17. make
  18. feature {ANY}
  19. root_type: LIBERTY_ACTUAL_TYPE
  20. root_feature_name: LIBERTY_FEATURE_NAME
  21. root_feature: LIBERTY_FEATURE_DEFINITION
  22. check_level: LIBERTY_MAIN_CHECK_LEVEL
  23. is_debug: BOOLEAN
  24. feature {}
  25. all_types: SET[LIBERTY_ACTUAL_TYPE]
  26. feature {LIBERTYC}
  27. compile_classes is
  28. -- Compile all the classes used by the program, if they need rebuilding.
  29. do
  30. end
  31. finalize is
  32. -- Builds (links) the final executable.
  33. -- Also adds specific runtime frameworks, such as a tailored GC etc.
  34. do
  35. end
  36. feature {}
  37. make (a_universe: like universe; a_root_type: like root_type; a_root_feature_name: like root_feature_name;
  38. a_check_level: like check_level; a_debug: like is_debug) is
  39. require
  40. a_universe /= Void
  41. a_root_type /= Void
  42. a_root_feature_name /= Void
  43. do
  44. universe := a_universe
  45. check_level := a_check_level
  46. is_debug := a_debug
  47. root_type := a_root_type
  48. root_feature_name := a_root_feature_name
  49. ensure_built(a_root_type)
  50. if not a_root_type.has_feature(a_root_feature_name) then
  51. std_error.put_string("Unknown feature ")
  52. std_error.put_string(a_root_feature_name.full_name)
  53. std_error.put_string(" in type ")
  54. std_error.put_line(a_root_type.full_name)
  55. die_with_code(1)
  56. end
  57. root_feature := a_root_type.feature_definition(a_root_feature_name)
  58. create {HASH_SET[LIBERTY_ACTUAL_TYPE]} all_types.make
  59. all_types.add(root_type)
  60. ensure
  61. universe = a_universe
  62. check_level = a_check_level
  63. is_debug = a_debug
  64. root_type = a_root_type
  65. root_feature_name = a_root_feature_name
  66. end
  67. universe: LIBERTY_UNIVERSE
  68. ensure_built (a_type: LIBERTY_ACTUAL_TYPE) is
  69. do
  70. universe.build_types(root_type, root_feature_name, a_type)
  71. end
  72. invariant
  73. universe /= Void
  74. root_type /= Void
  75. root_feature_name /= Void
  76. root_feature /= Void
  77. all_types /= Void
  78. all_types.fast_has(root_type)
  79. end -- class LIBERTY_COMPILER