Skip to content

Commit

Permalink
Merge 00c5991 into 5454458
Browse files Browse the repository at this point in the history
  • Loading branch information
fennecdjay committed Jul 6, 2019
2 parents 5454458 + 00c5991 commit 81c1cb0
Show file tree
Hide file tree
Showing 455 changed files with 2,116 additions and 1,829 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ It aims to be simple, small,

```cpp
// print hello world
<<<"Hello World">>>;
<<< "Hello World" >>>;
```
to run this, do

Expand Down
2 changes: 1 addition & 1 deletion ast
Submodule ast updated from f2f84a to 1b4487
4 changes: 2 additions & 2 deletions docs/01_Overview/00_First_Steps/01_InstallingGwion.mdr
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

## Get the sources

The source is accessible on [github](https://github.com).
The source is accessible on [github](https:#!github.com).

Provided you have git installed, you can get it with:

``` sh
git clone https://github.com/fennecdjay/gwion
git clone https:#!github.com/fennecdjay/gwion
```

then change to the source directory
Expand Down
12 changes: 6 additions & 6 deletions docs/01_Overview/Testing.mdr
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Tests
[test.sh](https://github.com/fennecdjay/Gwion/blob/dev/util/test.sh)
requires [valgrind](http://valgrind.org/)
[test.sh](https:#!github.com/fennecdjay/Gwion/blob/dev/util/test.sh)
requires [valgrind](http:#!valgrind.org/)
there are two kinds of tests:
* [gwion](#gwion-tests)
* [bash](#bash-tests)

## Gwion tests
those tests are just gwion (.gw) files, handling special comments:
* `// [skip]` (*optionally* followed by reason to skip)
* `// [todo]` (*optionally* followed by reason to delay testing)
* `// [contains]` followed by string to match
* `// [excludes]` followed by string not to match
* `#! [skip]` (*optionally* followed by reason to skip)
* `#! [todo]` (*optionally* followed by reason to delay testing)
* `#! [contains]` followed by string to match
* `#! [excludes]` followed by string not to match

## Shell test
those tests are just bash (.sh) files.
Expand Down
12 changes: 6 additions & 6 deletions docs/01_Overview/declaration.mdr
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ Declaring a primitive or an object is quite straight forward:
@``` decl0.gw
int i;
Object o;
<<<i, " ", o>>>;
<<< i, " ", o >>>;
@```
@exec gwion decl0.gw 2>&1

## Declaring a reference
However ...
@``` decl1.gw
Object @ref;
<<<"Reference points to no object yet: ", ref>>>;
//Object o @=> ref;
<<< "Reference points to no object yet: ", ref >>>;
#!Object o @=> ref;
new Object @=> ref;
<<<"But now it does: ", ref>>>;
<<< "But now it does: ", ref >>>;
@```
@exec make decl1.test

Expand All @@ -27,8 +27,8 @@ new Object @=> ref;

@``` decl2.gw
int ref[];
<<<ref>>>;
<<< ref >>>;
new int[2] @=> ref;
<<<ref>>>;
<<< ref >>>;
@```
@exec make decl2.test
6 changes: 3 additions & 3 deletions docs/02_Reference/01_Functions/Lambdas.mdr
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The syntax to create them is simple:
You can even use it to
### Call a function just once
@``` lambda_call0.gw
\ i { <<<"passed '", i, "'">>>; }(3);
\ i { <<< "passed '", i, "'" >>>; }(3);
@```
@exec make -s CONTAINS="passed '3'" lambda_call0.test

Expand All @@ -21,7 +21,7 @@ You can even use it to
### Passing to a function pointer
@``` lambda_fptr0.gw
typedef void fptr_t(int);
\ i { <<<"passed '", i, "'">>>; } @=> fptr_t fptr;
\ i { <<< "passed '", i, "'" >>>; } @=> fptr_t fptr;
fptr(4);
@```
@exec make -s CONTAINS="passed '4'" lambda_fptr0.test
Expand All @@ -32,6 +32,6 @@ typedef void fptr_t(int);
fun void test(fptr_t fptr) {
fptr(5);
}
test(\ i { <<<"passed '", i, "'">>>; });
test(\ i { <<< "passed '", i, "'" >>>; });
@```
@exec make -s CONTAINS="passed '5'" lambda_args0.test
4 changes: 2 additions & 2 deletions docs/02_Reference/01_Functions/Variadic.mdr
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ Well, a function that takes a fixed number of arguments, and additionnal ones.
## a simple example
@``` variadic.gw
fun void variadic_test(int i, ...) {
<<< "first argument is ", i >>>;
<<< "first argument is ", i >>>;
vararg.start;
<<< "\tadditionnal argument", vararg.i >>>;
<<< "\tadditionnal argument", vararg.i >>>;
vararg.end;
}
variadic_test(1);
Expand Down
16 changes: 8 additions & 8 deletions docs/02_Reference/01_Functions/function.mdr
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
## a simple (commented example)

@``` function0.gw
// declare function 'test_function'
// with return type int
// taking an int as argument
#! declare function 'test_function'
#! with return type int
#! taking an int as argument
fun int test_function(int arg) {
// return the argument + 2
#! return the argument + 2
return arg + 2;
}

// now call the function (and debug print the result)
<<<test_function(0)>>>;
// or use alternate syntax
<<<1 => test_function>>>;
#! now call the function (and debug print the result)
<<< test_function(0) >>>;
#! or use alternate syntax
<<< 1 => test_function >>>;
@```
@exec make -s function0.test
4 changes: 2 additions & 2 deletions docs/02_Reference/ControlFlow/Repeat.mdr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The easiest way to do an action repeatidly in Gwion is, ... the **repeat** keywo
## Very basic example
@``` repeat.gw
repeat(3)
<<<"Hello, world!">>>;
<<< "Hello, world!" >>>;
@```
@exec make -s CONTAINS="Hello" repeat.test

Expand All @@ -15,7 +15,7 @@ of course this also works with a block code.
@``` repeat2.gw
repeat(3) {
maybe ? "You" : "Me" => string s;
<<<"Hello, ", s, "!">>>;
<<< "Hello, ", s, "!" >>>;
}
@```
@exec make -s CONTAINS="Hello" repeat2.test
14 changes: 7 additions & 7 deletions docs/02_Reference/ControlFlow/forloop.mdr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## basic loops
@``` forloop0.gw
for(int i; i < 3; ++i)
<<<i>>>;
<<< i >>>;
@```
@exec make -s forloop0.test

Expand All @@ -14,7 +14,7 @@ Of course, it also works with a block of code.
for(int i; i < 3; ++i) {
i/2 => float f1;
i/2. => float f2;
<<<i, " " , f1, " ", f2>>>;
<<< i, " " , f1, " ", f2 >>>;
}
@```
@exec make -s forloop2.test
Expand All @@ -25,7 +25,7 @@ int array[3][4];

for(int i; i < 3; ++i) {
for(int j; j < 4; ++j) {
<<<array[i][j]>>>;
<<< array[i][j] >>>;
}
}
@```
Expand All @@ -37,9 +37,9 @@ for(int i; i < 3; ++i) {
@``` forloop4.gw
int array[2][3];
for(auto a: array) {
<<<a>>>;
<<< a >>>;
for(auto b: a)
<<<b>>>;
<<< b >>>;
}
@```
@exec make -s forloop4.test
Expand All @@ -53,11 +53,11 @@ int array[2][3];
int i;
for(auto a: array) {
for(auto @b: a)
<<<++i => *b>>>;
<<< ++i => *b >>>;
}
for(auto a: array) {
for(auto @b: a)
<<<*b>>>;
<<< *b >>>;
}
@```
@exec make -s forloop5.test
6 changes: 3 additions & 3 deletions docs/02_Reference/ControlFlow/whileuntil.mdr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
while(true) {
if(maybe)
break;
<<<"running...">>>;
<<< "running..." >>>;
}
@```
@exec make -s while0.test
Expand All @@ -13,11 +13,11 @@ well this may output nothing...
lets try

@``` while1.gw
<<<maybe>>>;
<<< maybe >>>;
do{
if(maybe)
break;
<<<"running...">>>;
<<< "running..." >>>;
} while(true);
@```
@exec make -s while1.test

0 comments on commit 81c1cb0

Please sign in to comment.