Carp/README.md

89 lines
3.2 KiB
Markdown
Raw Normal View History

2016-01-11 16:52:26 +03:00
# Carp
2016-01-11 16:55:03 +03:00
2016-01-18 20:15:58 +03:00
[![Join the chat at https://gitter.im/eriksvedang/Carp](https://badges.gitter.im/eriksvedang/Carp.svg)](https://gitter.im/eriksvedang/Carp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
2016-07-13 04:17:01 +03:00
[![Build Status](https://travis-ci.org/carp-lang/Carp.svg?branch=master)](https://travis-ci.org/carp-lang/Carp)
2016-01-18 20:15:58 +03:00
2016-07-13 14:18:21 +03:00
<img src="https://github.com/carp-lang/Carp/blob/master/img/carp_logo_300_c.png" alt="Logo" align="right" />
2016-01-11 17:46:14 +03:00
2016-03-18 09:42:32 +03:00
<i>WARNING! This is a research project and a lot of information here might become outdated and misleading without any explanation. Don't use it for anything important just yet!</i>
2016-01-11 22:14:48 +03:00
2016-01-11 17:57:24 +03:00
Carp is a small programming language designed to work well for interactive and performance sensitive use cases like games, sound synthesis and visualizations.
2016-01-11 17:46:14 +03:00
The key features of Carp are the following:
2016-01-11 18:59:43 +03:00
* Automatic and deterministic memory management (no garbage collector or VM)
2016-01-11 18:55:41 +03:00
* Inferred static types for great speed and reliability
2016-01-17 18:25:14 +03:00
* Live reloading of code, REPL-driven development, a fun and helpful workflow
2016-01-18 20:17:36 +03:00
* Ownership tracking enables a functional programming style while still using mutation of cache friendly data structures under the hood
2016-01-11 18:54:33 +03:00
* No hidden performance penalties allocation and copying is explicit
2016-06-10 10:02:41 +03:00
* Very good integration with existing C code
2016-01-11 17:57:24 +03:00
2016-01-18 18:49:14 +03:00
2016-03-18 09:40:57 +03:00
## Learn more
2016-02-18 12:46:31 +03:00
2016-09-01 16:58:54 +03:00
* [Installation](docs/Install.md) - how to build the Carp compiler
* [The Compiler Manual](docs/Manual.md) - how to compile code and configure your projects
* [Carp Language Guide](docs/Language.md) - syntax and semantics of the language
* [Libraries](docs/Libraries.md) - the various libraries that come built-in to Carp
2016-04-26 00:35:20 +03:00
* [typograf.carp](/examples/typograf.carp) - a more complex example
2016-01-13 16:12:42 +03:00
2016-03-18 09:40:57 +03:00
## A Small OpenGL/GLFW Example
2016-01-19 15:52:00 +03:00
2016-01-12 13:02:15 +03:00
```clojure
2016-03-18 09:40:57 +03:00
(import gl)
2016-01-12 13:02:15 +03:00
2016-03-31 17:34:19 +03:00
(defn init []
0f)
2016-03-18 09:40:57 +03:00
(defn tick [state]
2016-03-31 18:15:37 +03:00
(+ state 0.15f))
2016-01-18 18:39:14 +03:00
2016-03-18 09:40:57 +03:00
(defn draw [state]
2016-03-31 18:15:37 +03:00
(let [t @state
steps 100
step (/ 1f (itof steps))]
2016-03-31 17:34:19 +03:00
(for (i 0 steps)
2016-03-31 18:15:37 +03:00
(let [r (* step (itof i))
2016-03-31 17:34:19 +03:00
r2 (+ r step)]
(draw-line (* r (cosf (* t r)))
(* r (sinf (* t r)))
(* r2 (cosf (* t r2)))
(* r2 (sinf (* t r2))))))))
2016-03-02 02:35:57 +03:00
2016-03-18 09:40:57 +03:00
(defn spin []
2016-03-31 17:34:19 +03:00
(glfw-app "Spin" init tick draw default-on-keys))
2016-01-18 18:39:14 +03:00
```
2016-03-24 13:32:13 +03:00
To build this example, save it to a file called 'example.carp' and load it with ```(load-lisp "example.carp")```, then execute ```(bake-exe spin)``` to build an executable, or ```(spin)``` to run the program directly from the REPL.
2016-01-12 13:02:15 +03:00
2016-01-12 13:08:32 +03:00
2016-03-18 09:40:57 +03:00
### Contributors
2016-01-12 13:08:32 +03:00
2016-06-09 00:58:11 +03:00
* Erik Svedäng [@e_svedang](https://twitter.com/e_svedang)
2016-03-18 09:40:57 +03:00
* Markus Gustavsson
2016-03-23 21:45:32 +03:00
* Fyodor Shchukin
2016-06-20 07:34:46 +03:00
* Anes Lihovac
2016-07-04 11:09:16 +03:00
* Chris Hall
* Tom Smeding
2016-07-11 08:33:48 +03:00
* Dan Connolly
2016-07-11 10:17:27 +03:00
* Reini Urban
* Anes Lihovac
2016-07-14 21:25:36 +03:00
* Jonas Granquist
2016-02-18 12:46:31 +03:00
2016-08-23 16:42:39 +03:00
2016-01-19 15:29:06 +03:00
## License
2016-08-23 16:42:39 +03:00
Copyright 2016 Erik Svedäng
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
2016-01-19 15:29:06 +03:00
2016-08-23 16:42:39 +03:00
http://www.apache.org/licenses/LICENSE-2.0
2016-01-19 15:29:06 +03:00
2016-08-23 16:42:39 +03:00
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.