• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

rationale/H29-Sep-2021-5842

Arrays.rstH A D29-Sep-20217.7 KiB200153

Boolean_Values.rstH A D29-Sep-20214.3 KiB12394

Complex_Numbers.rstH A D29-Sep-20211.2 KiB3930

Definitions.rstH A D29-Sep-20215.7 KiB168129

Design_by_Contract.rstH A D29-Sep-20217.8 KiB206160

Expressions.rstH A D29-Sep-20212.4 KiB4942

File_Import.rstH A D29-Sep-20212.2 KiB5442

Functions.rstH A D29-Sep-202111.7 KiB300231

Generators.rstH A D29-Sep-20214.2 KiB131103

Grammar.rstH A D29-Sep-20219.5 KiB279225

Lists.rstH A D29-Sep-20216.3 KiB177131

Matrices.rstH A D29-Sep-2021983 2721

Null.rstH A D29-Sep-2021406 108

Numbers.rstH A D29-Sep-20213.6 KiB12395

Parametric_Shapes.rstH A D29-Sep-20212.9 KiB7255

Patterns.rstH A D29-Sep-20215.4 KiB161114

Programs.rstH A D29-Sep-20213 KiB11784

README.rstH A D29-Sep-20215.6 KiB152128

Records.rstH A D29-Sep-20216.1 KiB171129

Shape_Compiler.rstH A D29-Sep-20212.1 KiB4337

Statements.rstH A D29-Sep-202111.7 KiB271222

Strings.rstH A D29-Sep-20217.8 KiB201158

Trees.rstH A D29-Sep-20215.5 KiB169124

Trigonometry.rstH A D29-Sep-20212.2 KiB9368

Values.rstH A D29-Sep-20211.2 KiB3126

Variant.rstH A D29-Sep-20213.4 KiB10678

Vectors.rstH A D29-Sep-20213.3 KiB8264

README.rst

1The Core Language
2=================
3
4This document is the reference manual and design rationale
5for the Curv core language, which underlies the shape library.
6
7Design Goals
8------------
9* Ease of use for artists and novice programmers.
10  The focus is artistic exploration, not software engineering.
11  No `boilerplate`_: the simple program ``cube`` is sufficient to construct a cube.
12* Expressive power for expert programmers.
13  The shape library is written entirely in Curv.
14  Libraries of new shape operations can be written in Curv and distributed over the internet.
15* Rendering speed.
16  Curv programs are compiled into efficient GPU code for fast rendering.
17* Interoperability with other programming languages. (Future)
18  Two way data interchange with external programs. The shape library can be embedded
19  in other programming languages (like Javascript and Python).
20* Safety and security.
21  A Curv program downloaded from the internet can't encrypt all your files
22  or exfiltrate personal information to a server.
23
24.. _`boilerplate`: https://en.wikipedia.org/wiki/Boilerplate_code
25
26Language Characteristics
27------------------------
28
29Simple, Elegant, Powerful
30  The Curv language is based on a small number of orthogonal concepts
31  that can be combined together with no arbitrary restrictions.
32  This results in a relatively simple language with a lot of expressive power.
33  The core language is small enough to learn in a day.
34
35Simple Type System
36  Curv is a dynamically typed language with 6 value types:
37  symbols, numbers, characters, lists, records, and functions.
38  Everything else is represented using combinations of these primitives.
39  There are no type names or type declarations.
40
41..
42  Interoperability
43    Curv is a superset of JSON. The type system comprises the 6 JSON data types,
44    plus functions. Most JSON programs are also valid Curv programs.
45    Since JSON is a standard data interchange format supported by all popular
46    programming languages, this design provides three benefits:
47
48    * Because the type system is so simple, it's easy to embed
49      the Curv type system in another programming language.
50      And that makes it feasible to import Curv data and libraries
51      into other programming languages, or to export Curv data and libraries from
52      other languages.
53    * Curv can be used as a data interchange format for pure functional data.
54    * Curv can import and export JSON data.
55
56Pure Functional Language
57  Curv is a pure functional language.
58
59  * Functions_ are first class values, meaning that they can be bound to variables,
60    passed as function arguments and returned as function results.
61  * Functions are pure, meaning that the result returned by a function depends
62    only on the argument value, and not on shared mutable state, which doesn't
63    exist in Curv.
64  * Data structures are immutable values, not mutable objects.
65  * Expressions do not have side effects.
66  * There is no I/O: Curv is not a scripting language.
67    The only outcome of a running a program
68    is to compute a value (which is usually a geometric shape).
69
70Expression Language
71  Curv is an expression language, not a statement language.
72  A program is an expression, not a statement list.
73  The body of a function is an expression, not a statement list.
74
75Functional Programming
76  Higher order functions, curried functions, pattern matching,
77  list/record/string comprehensions, tail call optimization.
78
79Imperative Programming
80  Curv has a small imperative subset: assignment statements, compound statements,
81  if statements, while loops, for loops. This allows algorithms to be coded
82  in an imperative style, but statement semantics are tightly restricted so that
83  the expression language still has pure functional semantics.
84
85Array Programming
86  Curv is an array language. Scalar arithmetic operations are generalized
87  to work on Vectors_, Matrices_, and `higher dimensional arrays`_.
88  This makes geometric algorithms involving linear algebra easier to code,
89  and these operations take advantage of vector hardware on GPUs for fast
90  rendering.
91
92.. _`higher dimensional arrays`: Arrays.rst
93
94Table of Contents
95-----------------
96Introduction: `Programs`_
97
98The six types of `Values`_:
99
100* `Symbols`_ -- which include `Boolean Values`_
101* `Numbers`_ -- and `Trigonometry`_
102* `Characters`_
103* `Lists`_ -- which include `Strings`_, `Complex Numbers`_,
104  `Vectors`_, `Matrices`_ and `Arrays`_
105* `Records`_
106* `Functions`_
107
108Basic Syntax:
109
110* `Programs`_
111* `Expressions`_
112* `Definitions`_ (local variables)
113* `Parametric Shapes`_
114* `Statements`_ (imperative style programming)
115* `Patterns`_
116* `File Import`_
117
118Advanced Topics:
119
120* `Shape Compiler`_
121* `Tail Call Optimization`_
122* `Design by Contract`_
123* `Imperative Style Programming in a Pure Functional Language`_
124* `Grammar`_
125
126.. _`Arrays`: Arrays.rst
127.. _`Boolean Values`: Boolean_Values.rst
128.. _`Characters`: Strings.rst
129.. _`Complex Numbers`: Complex_Numbers.rst
130.. _`Definitions`: Definitions.rst
131.. _`Design by Contract`: Design_by_Contract.rst
132.. _`Expressions`: Expressions.rst
133.. _`File Import`: File_Import.rst
134.. _`Functions`: Functions.rst
135.. _`Shape Compiler`: Shape_Compiler.rst
136.. _`Grammar`: Grammar.rst
137.. _`Imperative Style Programming in a Pure Functional Language`: ../theory/Imperative.rst
138.. _`Lists`: Lists.rst
139.. _`Matrices`: Matrices.rst
140.. _`Symbols`: Variant.rst
141.. _`Numbers`: Numbers.rst
142.. _`Parametric Shapes`: Parametric_Shapes.rst
143.. _`Patterns`: Patterns.rst
144.. _`Programs`: Programs.rst
145.. _`Records`: Records.rst
146.. _`Statements`: Statements.rst
147.. _`Strings`: Strings.rst
148.. _`Tail Call Optimization`: ../theory/Tail_Call.rst
149.. _`Trigonometry`: Trigonometry.rst
150.. _`Values`: Values.rst
151.. _`Vectors`: Vectors.rst
152