Crystal Programming Language

This is the language reference for the Crystal programming language.

Crystal is a programming language with the following goals:

  • Have a syntax similar to Ruby (but compatibility with it is not a goal).
  • Be statically type-checked, but without having to specify the type of variables or method arguments.
  • Be able to call C code by writing bindings to it in Crystal.
  • Have compile-time evaluation and generation of code, to avoid boilerplate code.
  • Compile to efficient native code.

Crystal’s standard library is documented in the API docs.

Contributing to the Language Reference

Do you consider yourself a helpful person? If you find bugs or sections
which need more clarification you’re welcome to contribute to this
language reference. You can submit a pull request to this repository:
https://github.com/crystal-lang/crystal-book

Thank you very much!

Building and Serving Locally

  1. $ git clone https://github.com/crystal-lang/crystal-book.git
  2. $ cd crystal-book
  3. $ npm install -g gitbook-cli@2.3.0
  4. $ npm install
  5. $ gitbook install
  6. $ gitbook serve
  7. Live reload server started on port: 35729
  8. Press CTRL+C to quit ...
  9. info: 8 plugins are installed
  10. info: loading plugin "ga"... OK
  11. ...
  12. Starting server ...
  13. Serving book on http://localhost:4000

Html output will be in _book folder (some links won’t work if opening the files locally).
There is also a docker environment to avoid installing dependencies globally:

  1. $ docker-compose up
  2. ...
  3. gitbook_1 | Starting server ...
  4. gitbook_1 | Serving book on http://localhost:4000
  5. gitbook_1 | Restart after change in file node_modules/.bin
  6. ...

Adding a page

To add a page, create a markdown file in the desired location. Example: overview/hello_world.md. Then, add a link in the SUMMARY.md file which acts as the navigation for the language reference.