1_files.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <title>Gravity: Files</title>
  7. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css" />
  8. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  9. <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:400,700,800">
  10. <link rel="stylesheet" href="../scripts/highlight/styles/github-gist.css">
  11. <link rel="stylesheet" href="../stylesheets/styles.css">
  12. <script src="https://use.fontawesome.com/2e9ff283e5.js"></script>
  13. </head>
  14. <body>
  15. <!-- BEGIN NAVIGATION BAR -->
  16. <nav class="navbar navbar-default navbar-fixed-top">
  17. <div class="container">
  18. <div class="navbar-header">
  19. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
  20. <span class="sr-only">Toggle navigation</span>
  21. <span class="icon-bar"></span>
  22. <span class="icon-bar"></span>
  23. <span class="icon-bar"></span>
  24. </button>
  25. <a class="navbar-brand" href="http://gravity-lang.org"><img src="../images/logo.png" width="32px" height="36px"></a>
  26. </div>
  27. <div id="navbar" class="navbar-collapse collapse">
  28. <ul class="nav navbar-nav navbar-right">
  29. <li><a href="../index.html">Gravity</a></li>
  30. <li class="active"><a href="index.html">Internals</a></li>
  31. <li><a href="https://github.com/marcobambini/gravity">GitHub</a></li>
  32. </ul>
  33. </div><!--/.nav-collapse -->
  34. </div>
  35. </nav>
  36. <!-- END NAVIGATION BAR -->
  37. <div class="container body-container">
  38. <div class="main-content">
  39. <div class="row">
  40. <!-- BEGIN SIDEBAR -->
  41. <div class="col-sm-3 border-right section-left">
  42. <div saveheight="1" class="sidebar-nav">
  43. <h4>1. OVERVIEW</h4>
  44. <ul>
  45. <li><a href="index.html"><span>Introduction</span></a></li>
  46. <li><a href="1_changelog.html"><span>Changelog</span></a></li>
  47. <li><a href="1_files.html" class="active"><span>Gravity files</span></a></li>
  48. </ul>
  49. <h4>2. PREREQUISITES</h4>
  50. <ul>
  51. <li><a href="2_overview.html"><span>Overview</span></a></li>
  52. <li><a href="2_array.html"><span>Array</span></a></li>
  53. <li><a href="2_hash.html"><span>Hash</span></a></li>
  54. <li><a href="2_memory.html"><span>Memory</span></a></li>
  55. <li><a href="2_utils.html"><span>Utils</span></a></li>
  56. <li><a href="2_json.html"><span>JSON</span></a></li>
  57. <li><a href="2_visitor.html"><span>Visitor Pattern</span></a></li>
  58. <li><a href="2_vm.html"><span>Stack vs Register VM</span></a></li>
  59. <li><a href="2_class.html"><span>Class and metaclass</span></a></li>
  60. </ul>
  61. <h4>3. COMPILER</h4>
  62. <ul>
  63. <li><a href="3_overview.html"><span>Overview</span></a></li>
  64. <li><a href="3_grammar.html"><span>Grammar</span></a></li>
  65. <li><a href="3_lexer.html"><span>Lexer</span></a></li>
  66. <li><a href="3_parser.html"><span>Parser</span></a></li>
  67. <li><a href="3_prattparser.html"><span>Pratt Parser</span></a></li>
  68. <li><a href="3_ast.html"><span>AST</span></a></li>
  69. <li><a href="3_symboltable.html"><span>Symbol Table</span></a></li>
  70. <li><a href="3_semantic.html"><span>Semantic Analyses</span></a></li>
  71. <li><a href="3_opcodes.html"><span>Opcodes</span></a></li>
  72. <li><a href="3_ircode.html"><span>IRCode</span></a></li>
  73. <li><a href="3_codegen.html"><span>Code Generation</span></a></li>
  74. <li><a href="3_optimizer.html"><span>Optimizer</span></a></li>
  75. <li><a href="3_bytecode.html"><span>Bytecode</span></a></li>
  76. </ul>
  77. <h4>4. RUNTIME</h4>
  78. <ul>
  79. <li><a href="4_overview.html"><span>Overview</span></a></li>
  80. <li><a href="4_objmodel.html"><span>Object Model</span></a></li>
  81. <li><a href="4_memory.html"><span>Memory Ownership</span></a></li>
  82. <li><a href="4_vm.html"><span>Virtual Machine</span></a></li>
  83. <li><a href="4_performance.html"><span>Efficient Interpreter</span></a></li>
  84. <li><a href="4_base.html"><span>Base Classes</span></a></li>
  85. <li><a href="4_gc.html"><span>Garbage Collector</span></a></li>
  86. </ul>
  87. <h4>5. LLVM</h4>
  88. <ul>
  89. <li><a href="5_overview.html"><span>Overview</span></a></li>
  90. <li><a href="5_jit.html"><span>LLVM JIT</span></a></li>
  91. </ul>
  92. </div>
  93. </div>
  94. <!-- END SIDEBAR -->
  95. <!-- BEGIN CONTENT -->
  96. <div class="col-sm-9 border-left section-right">
  97. <h1 class="section-header">Gravity files</h1><hr>
  98. <p class="section-content">
  99. In order to increase modularity, Gravity is divided into 4 main components and each one (except shared) is completely independent from the others. In this way there is a clear separation between the compiler itself that end up producing the bytecode and the virtual machine that is responsible to execute that bytecode.
  100. </p>
  101. <p style="color: #7E267E;"><i class="fa fa-folder-o" aria-hidden="true"></i> Utils</p>
  102. <ul style="list-style: none;">
  103. <li style="color: #7E267E; margin: 8px 0;"><i class="fa fa-file-text-o" aria-hidden="true"></i> gravity_utils: <span style="color: #797979;">Collects useful functions extensively used by other files. Time, IO, strings, UTF-8 and many other functions can be found in this file.</span></li>
  104. <li style="color: #7E267E; margin: 8px 0;"><i class="fa fa-file-text-o" aria-hidden="true"></i> gravity_json: <span style="color: #797979;">Very efficient JSON parser from <a href="https://github.com/udp/json-parser">https://github.com/udp/json-parser</a>.</span></li>
  105. <li style="color: #7E267E; margin: 8px 0;"><i class="fa fa-file-text-o" aria-hidden="true"></i> gravity_debug: <span style="color: #797979;">Contains the gravity_disassemble function used for debugging purpose.</span></li>
  106. <!--<li style="color: #7E267E; margin: 8px 0;"><i class="fa fa-file-text-o" aria-hidden="true"></i> gravity_objc: <span style="color: #797979;">Official objc bridge used in the <a href="http://creolabs.com">Creo</a> project (not yet committed).</span></li>-->
  107. </ul>
  108. <p style="color: #7E267E;"><i class="fa fa-folder-o" aria-hidden="true"></i> Compiler</p>
  109. <ul style="list-style: none;">
  110. <li style="color: #7E267E; margin: 8px 0;"><i class="fa fa-file-text-o" aria-hidden="true"></i> debug_macros: <span style="color: #797979;">Debug macros used internally during development.</span></li>
  111. <li style="color: #7E267E; margin: 8px 0;"><i class="fa fa-file-text-o" aria-hidden="true"></i> gravity_ast: <span style="color: #797979;">Abstract syntax tree implementation.</span></li>
  112. <li style="color: #7E267E; margin: 8px 0;"><i class="fa fa-file-text-o" aria-hidden="true"></i> gravity_codegen: <span style="color: #797979;">Code generation module.</span></li>
  113. <li style="color: #7E267E; margin: 8px 0;"><i class="fa fa-file-text-o" aria-hidden="true"></i> gravity_compiler: <span style="color: #797979;">Main compiler module that can hides other internal modules.</span></li>
  114. <li style="color: #7E267E; margin: 8px 0;"><i class="fa fa-file-text-o" aria-hidden="true"></i> gravity_ircode: <span style="color: #797979;">Intermediate code and register allocation management.</span></li>
  115. <li style="color: #7E267E; margin: 8px 0;"><i class="fa fa-file-text-o" aria-hidden="true"></i> gravity_lexer: <span style="color: #797979;">Lexer implementation.</span></li>
  116. <li style="color: #7E267E; margin: 8px 0;"><i class="fa fa-file-text-o" aria-hidden="true"></i> gravity_optimizer: <span style="color: #797979;">Optimizer and bytecode finalyzer.</span></li>
  117. <li style="color: #7E267E; margin: 8px 0;"><i class="fa fa-file-text-o" aria-hidden="true"></i> gravity_parser: <span style="color: #797979;">Parser implementation and syntax checker.</span></li>
  118. <li style="color: #7E267E; margin: 8px 0;"><i class="fa fa-file-text-o" aria-hidden="true"></i> gravity_semacheck1: <span style="color: #797979;">Semantic checker step 1 (used for non-local identifiers).</span></li>
  119. <li style="color: #7E267E; margin: 8px 0;"><i class="fa fa-file-text-o" aria-hidden="true"></i> gravity_semacheck2: <span style="color: #797979;">Semantic checker step 2 (used for local identifiers).</span></li>
  120. <li style="color: #7E267E; margin: 8px 0;"><i class="fa fa-file-text-o" aria-hidden="true"></i> gravity_symboltable: <span style="color: #797979;">Symbol table management and creation.</span></li>
  121. <li style="color: #7E267E; margin: 8px 0;"><i class="fa fa-file-text-o" aria-hidden="true"></i> gravity_token: <span style="color: #797979;">Tokenizer implementation.</span></li>
  122. <li style="color: #7E267E; margin: 8px 0;"><i class="fa fa-file-text-o" aria-hidden="true"></i> gravity_visitor: <span style="color: #797979;">Visitor patter for C.</span></li>
  123. </ul>
  124. <p style="color: #7E267E;"><i class="fa fa-folder-o" aria-hidden="true"></i> Shared</p>
  125. <ul style="list-style: none;">
  126. <li style="color: #7E267E; margin: 8px 0;"><i class="fa fa-file-text-o" aria-hidden="true"></i> gravity_array: <span style="color: #797979;">Dynamic array macros implementation from <a href="https://github.com/attractivechaos/klib/blob/master/kvec.h">https://github.com/attractivechaos/klib/blob/master/kvec.h</a>.</span></li>
  127. <li style="color: #7E267E; margin: 8px 0;"><i class="fa fa-file-text-o" aria-hidden="true"></i> gravity_delegate: <span style="color: #797979;">This is where utilities are collected in a single file.</span></li>
  128. <li style="color: #7E267E; margin: 8px 0;"><i class="fa fa-file-text-o" aria-hidden="true"></i> gravity_hash: <span style="color: #797979;">Hash table implementation.</span></li>
  129. <li style="color: #7E267E; margin: 8px 0;"><i class="fa fa-file-text-o" aria-hidden="true"></i> gravity_macros: <span style="color: #797979;">Useful macros mainly used at runtime.</span></li>
  130. <li style="color: #7E267E; margin: 8px 0;"><i class="fa fa-file-text-o" aria-hidden="true"></i> gravity_memory: <span style="color: #797979;">Memory management module with built-in leaks checker for MacOS.</span></li>
  131. <li style="color: #7E267E; margin: 8px 0;"><i class="fa fa-file-text-o" aria-hidden="true"></i> gravity_opcodes: <span style="color: #797979;">Enum opcodes officially supported by Gravity.</span></li>
  132. <li style="color: #7E267E; margin: 8px 0;"><i class="fa fa-file-text-o" aria-hidden="true"></i> gravity_value: <span style="color: #797979;">One of the most important module that declare the struct of each object and value used inside Gravity.</span></li>
  133. </ul>
  134. <p style="color: #7E267E;"><i class="fa fa-folder-o" aria-hidden="true"></i> Runtime</p>
  135. <ul style="list-style: none;">
  136. <li style="color: #7E267E; margin: 8px 0;"><i class="fa fa-file-text-o" aria-hidden="true"></i> gravity_core: <span style="color: #797979;">Core classes implementation and definition.</span></li>
  137. <li style="color: #7E267E; margin: 8px 0;"><i class="fa fa-file-text-o" aria-hidden="true"></i> gravity_vm: <span style="color: #797979;">Interpreter and garbage collector implementation.</span></li>
  138. <li style="color: #7E267E; margin: 8px 0;"><i class="fa fa-file-text-o" aria-hidden="true"></i> gravity_vmmacros: <span style="color: #797979;">Collects various macros used by the Virtual Machine.</span></li>
  139. </ul>
  140. </div>
  141. <!-- END CONTENT -->
  142. </div> <!-- /row -->
  143. </div> <!-- /main-content -->
  144. </div> <!-- /container -->
  145. <!-- BEGIN FOOTER -->
  146. <footer class="navbar-fixed-bottom">
  147. <div class="container footer">
  148. <p>
  149. </p>
  150. </div>
  151. </footer>
  152. <!-- END FOOTER -->
  153. <!-- Bootstrap JS -->
  154. <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
  155. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  156. <!-- Highlights JS -->
  157. <script src="../scripts/highlight/highlight.min.js"></script>
  158. <script>hljs.initHighlightingOnLoad();</script>
  159. </body>
  160. </html>