Skip to content
This repository was archived by the owner on Nov 10, 2017. It is now read-only.

Commit 322c4cb

Browse files
author
Ary Borenszweig
committed
Update README.markdown
1 parent 20ae83e commit 322c4cb

File tree

1 file changed

+1
-73
lines changed

1 file changed

+1
-73
lines changed

README.markdown

+1-73
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,4 @@
11
Crystal
22
=======
33

4-
Crystal is a programming language that compiles to native code.
5-
It has a syntax strongly inspired by Ruby:
6-
7-
* No need to declare types: everything is inferred.
8-
* Classes and Modules can be opened: at compile time everything is mixed together
9-
* String interpolation
10-
* Regular expression interpolation
11-
* Instance variables start with @
12-
* Global variables start with $
13-
* Constants start with Capital Letters
14-
* Functions can be evaluated at compile time as long as they are assigned to a Constant.
15-
16-
How to run it in your machine
17-
-----------------------------
18-
19-
Clone, run bundle, but ruby-llvm should be version 2.9.2. Now, that
20-
version was not released and is not in RubyGems, you can get it from
21-
here: [http://jvoorhis.com/ruby-llvm/ruby-llvm-2.9.2.gem](http://jvoorhis.com/ruby-llvm/ruby-llvm-2.9.2.gem)
22-
23-
The only problem is... the native extensions don't seem to compile
24-
anymore. So if anyone finds a solution for this: very, very welcome! :-)
25-
26-
Then you'll have five executables:
27-
28-
* bin/compile => compiles a given file.cr down to machine down
29-
* bin/dump => shows the unoptimized llvm file for a a given file.cr
30-
* bin/icr => interactive crystal shell
31-
* bin/interpret => interprets a given file.cr
32-
* bin/ll => shows the optimized llvm file for a given file.ll
33-
34-
Examples
35-
--------
36-
37-
Hello World
38-
39-
puts "Hello World"
40-
41-
Fibbonacci
42-
43-
def fib n
44-
if n <= 2
45-
1
46-
else
47-
fib(n - 1) + fib(n - 2)
48-
end
49-
end
50-
51-
Value = fib 6
52-
puts Value
53-
54-
Compiles to...
55-
56-
puts 8
57-
58-
Constants as arguments
59-
60-
def static N, x
61-
if N == 1
62-
2 * x
63-
else
64-
3 * x
65-
end
66-
end
67-
68-
puts static(2, 6)
69-
70-
Compiles to...
71-
72-
def static_2 x
73-
3 * x
74-
end
75-
76-
puts static_2(6)
4+
Project moved: [https://github.com/manastech/crystal](https://github.com/manastech/crystal)

0 commit comments

Comments
 (0)