getting-started.html 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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: Getting started</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. </head>
  13. <body>
  14. <!-- BEGIN NAVIGATION BAR -->
  15. <nav class="navbar navbar-default navbar-fixed-top">
  16. <div class="container">
  17. <div class="navbar-header">
  18. <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
  19. <span class="sr-only">Toggle navigation</span>
  20. <span class="icon-bar"></span>
  21. <span class="icon-bar"></span>
  22. <span class="icon-bar"></span>
  23. </button>
  24. <a class="navbar-brand" href="http://gravity-lang.org"><img src="images/logo.png" width="32px" height="36px"></a>
  25. </div>
  26. <div id="navbar" class="navbar-collapse collapse">
  27. <ul class="nav navbar-nav navbar-right">
  28. <li class="active"><a href="index.html">Gravity</a></li>
  29. <li><a href="internals/index.html">Internals</a></li>
  30. <li><a href="https://github.com/marcobambini/gravity">GitHub</a></li>
  31. </ul>
  32. </div><!--/.nav-collapse -->
  33. </div>
  34. </nav>
  35. <!-- END NAVIGATION BAR -->
  36. <div class="container body-container">
  37. <div class="main-content">
  38. <div class="row">
  39. <!-- BEGIN SIDEBAR -->
  40. <div class="col-sm-3 border-right section-left">
  41. <div saveheight="1" class="sidebar-nav">
  42. <h4>INTRODUCTION</h4>
  43. <ul>
  44. <li><a href="index.html"><span>Introduction</span></a></li>
  45. <li><a href="getting-started.html" class="active"><span>Getting Started</span></a></li>
  46. </ul>
  47. <h4>LANGUAGE GUIDE</h4>
  48. <ul>
  49. <li><a href="syntax.html"><span>Syntax</span></a></li>
  50. <li><a href="operators.html"><span>Operators</span></a></li>
  51. <li><a href="types.html"><span>Types</span></a></li>
  52. <li><a href="lists.html"><span>Lists</span></a></li>
  53. <li><a href="maps.html"><span>Maps</span></a></li>
  54. <li><a href="enum.html"><span>Enum</span></a></li>
  55. <li><a href="functions.html"><span>Functions</span></a></li>
  56. <li><a href="closures.html"><span>Closures</span></a></li>
  57. <li><a href="classes.html"><span>Classes</span></a></li>
  58. <li><a href="control-flow.html"><span>Control Flow</span></a></li>
  59. <li><a href="loops.html"><span>Loops</span></a></li>
  60. <li><a href="fibers.html"><span>Fibers</span></a></li>
  61. </ul>
  62. <h4>ADVANCED</h4>
  63. <ul>
  64. <li><a href="api.html"><span>Embedding API</span></a></li>
  65. <li><a href="system.html"><span>System class</span></a></li>
  66. <li><a href="unit-test.html"><span>Unit test</span></a></li>
  67. <li><a href="contributing.html"><span>Contributing</span></a></li>
  68. </ul>
  69. </div>
  70. </div>
  71. <!-- END SIDEBAR -->
  72. <!-- BEGIN CONTENT -->
  73. <div class="col-sm-9 border-left section-right">
  74. <h1 class="section-header">Getting started</h1><hr>
  75. <!-- Installation -->
  76. <h4 class="section-h4">Install</h4>
  77. <p class="section-content">
  78. To install Gravity, simply execute the commands given below. It should make two executables: the compiler itself
  79. and test runner.
  80. <pre><code>
  81. git clone https://github.com/marcobambini/gravity.git
  82. cd gravity
  83. make
  84. </code></pre>
  85. </p>
  86. <blockquote>
  87. <p>If you want to access the gravity compiler globally just add it to your <b>PATH</b>!</p>
  88. </blockquote>
  89. <blockquote>
  90. <p>You can also use the <strong>Xcode</strong> project to create the gravity or unittest executables.</p>
  91. </blockquote>
  92. <!-- Editor -->
  93. <h4 class="section-h4">Configure your editor</h4>
  94. <p>
  95. Programming is way more enjoyable when you have the right tools! That's why we
  96. equipped several code editors with Gravity support!
  97. Just click on your favourite editor and configure it accordingly:
  98. <ul>
  99. <li><a href="https://github.com/Dohxis/vscode-gravity">Visual Studio Code</a></li>
  100. <li><a href="https://github.com/Tribex/atom-language-gravity">Atom</a></li>
  101. <li><a href="https://github.com/hallzy/gravity.vim">vim</a></li>
  102. <li><a href="https://github.com/marcobambini/bbedit-gravity">BBEdit/TextWrangler</a></li>
  103. </ul>
  104. </p>
  105. <!-- Command line -->
  106. <h4 class="section-h4">Command line</h4>
  107. <p>To view all possible flags you can run the command below:</p>
  108. <pre><code>
  109. ./gravity --help
  110. </code></pre>
  111. <p>To compile a gravity file to a exec.json executable:</p>
  112. <pre><code>
  113. ./gravity -c myfile.gravity -o exec.json
  114. </code></pre>
  115. <p>To execute a precompiled json executable file:</p>
  116. <pre><code>
  117. ./gravity -x exec.json
  118. </code></pre>
  119. <p>To directly execute a gravity file (without first serializing it to json):</p>
  120. <pre><code>
  121. ./gravity myfile.gravity
  122. </code></pre>
  123. <!-- Command line -->
  124. <h4 class="section-h4">Unit Tests</h4>
  125. <p>You can run unit tests by providing a path to a folder containing all tests:</p>
  126. <pre><code>
  127. ./unittest path_to_test_folder
  128. </code></pre>
  129. <p>You should obtain an output like:
  130. <img src="images/unittest.png" width="666px" height="466px">
  131. </p>
  132. </div>
  133. <!-- END CONTENT -->
  134. </div> <!-- /row -->
  135. </div> <!-- /main-content -->
  136. </div> <!-- /container -->
  137. <!-- BEGIN FOOTER -->
  138. <footer class="navbar-fixed-bottom">
  139. <div class="container footer">
  140. <p>
  141. </p>
  142. </div>
  143. </footer>
  144. <!-- END FOOTER -->
  145. <!-- Bootstrap JS -->
  146. <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
  147. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  148. <!-- Highlights JS -->
  149. <script src="scripts/highlight/highlight.min.js"></script>
  150. <script>hljs.initHighlightingOnLoad();</script>
  151. </body>
  152. </html>