Skip to content

Commit

Permalink
Merge pull request #454 from dictu-lang/develop
Browse files Browse the repository at this point in the history
Release 0.21.0
  • Loading branch information
Jason2605 authored Oct 4, 2021
2 parents e07b84d + 7c814a8 commit 82da2ce
Show file tree
Hide file tree
Showing 42 changed files with 911 additions and 45 deletions.
74 changes: 74 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Bug Report
description: Create a bug-report to help us address errors and bugs.
title: "[BUG]"
labels: [bug]
body:
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for the bug you encountered.
options:
- label: I have searched the existing issues
required: true
- type: textarea
attributes:
label: Current Behavior
description: A concise description of what you're experiencing.
validations:
required: false
- type: textarea
attributes:
label: Expected Behavior
description: A concise description of what you expected to happen.
validations:
required: false
- type: textarea
attributes:
label: Steps To Reproduce
description: Steps to reproduce the behavior.
placeholder: |
1. In this environment...
2. With this config...
3. Run '...'
4. See error...
validations:
required: false
- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Anything that will give us more context about the issue you are encountering!
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false

---
name: Bug Report
about: Create a bug-report to help us address errors and bugs.
title: 'BUG'
labels: "bug"

---

**Description**

<!--A clear and concise description of what the bug is.-->

**Error Code:**

Error Message Displayed:

**Working Environment**

Operating System (eg Linux):

Dictu Version:

**Screenshots**

Please add a screenshot if applicable

[Optional] **Additional Context**

Add any other context about the problem here.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: true
49 changes: 49 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Feature Request
description: Suggest an idea for this project.
title: "[FEATURE]"
labels: [feature request]
body:
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for the feature you are requesting.
options:
- label: I have searched the existing issues
required: true
- type: textarea
attributes:
label: Is your feature request related to a problem?
description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
validations:
required: false
- type: textarea
attributes:
label: Describe the solution you'd like
description: A clear and concise description of what you want to happen.
validations:
required: false
- type: textarea
attributes:
label: Describe alternatives you've considered
description: A clear and concise description of any alternative solutions or features you've considered.
validations:
required: false
- type: textarea
attributes:
label: Additional context
description: Add any other context such as screenshots, schematics, about the feature request here.
validations:
required: false

---
name: Feature Request
about: Suggest an idea for this project
title: '[FEATURE]'
labels: "feature request"

---
name: Feature/Enhancement request
about: Suggest an idea for this project.
title: "[FEATURE]"
labels: feature request
---
53 changes: 53 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<!---- This is the PR Template !-->

<!-- Make sure to follow each step so that your PR is explained and easy to read !-->

<!-- This will allow maintainers and other potential contributors to understand the changes being carried out !-->

<!--- Thanks for considering that !-->

### Well detailed description of the change :

<!-- Explain what you have done !-->

I worked on the .....

#

### Context of the change :

<!-- Make sure to answer to these questions !-->

- Why is this change required ?

<!-- Link the issue below if you are resolving an issue !-->

- Does it solve a problem ? (please link the issue)

#

### Type of change :

<!-- Please select relevant options -->

<!-- add a x in [ ] if true !-->

<!-- Delete options that aren't relevant!-->


- [ ] Bug fix

- [ ] New feature

- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

#

### Preview (Screenshots) :

<!-- While providing screenshots, delete the text below !-->

<!-- try as much as possible to explain each change in each screenshot !-->

<p align="center">If it is possible, please link screenshots of your changes preview !
</p>
18 changes: 15 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, ubuntu-16.04, ubuntu-20.04]
os: [ubuntu-latest, ubuntu-20.04]

steps:
- uses: actions/checkout@v2
Expand All @@ -36,7 +36,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macOS-latest]
os: [macOS-latest, macOS-11]

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -66,4 +66,16 @@ jobs:
run: |
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_SYSTEM_VERSION="10.0.18362.0" -DCICD=1 -DDISABLE_HTTP=1 -DDISABLE_LINENOISE=1 -B build
cmake --build build
Debug\dictu.exe tests/runTests.du
Debug\dictu.exe tests/runTests.du
run-examples:
name: Test Examples
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Make dictu and run examples
run: |
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev
cmake -DCMAKE_BUILD_TYPE=Debug -B ./build
cmake --build ./build
./dictu examples/runExamples.du | tee /dev/stderr | grep -q 'Total memory usage: 0'
2 changes: 1 addition & 1 deletion docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: >-
color_scheme: "dictu" # Custom theme
logo: "/assets/images/dictu-logo/dictu-wordmark.svg"

version: "0.20.0"
version: "0.21.0"
github_username: dictu-lang
search_enabled: true

Expand Down
10 changes: 10 additions & 0 deletions docs/docs/built-ins.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ print("test"); // "test"
print(10, "test", nil, true); // 10, "test", nil, true
```

### printError(...values...)

Prints a given list of values to stderr.

```cs
printError(10); // 10
printError("test"); // "test"
printError(10, "test", nil, true); // 10, "test", nil, true
```

### input(string: prompt -> optional)

Gathers user input from stdin and returns the value as a string. `input()` has an optional prompt which will be shown to
Expand Down
45 changes: 44 additions & 1 deletion docs/docs/classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -561,4 +561,47 @@ var anotherTestObj = AnotherTest();
testObj.isInstance(AnotherTest); // false
anotherTestObj.isInstance(AnotherTest); // true
anotherTestObj.isInstance(Test); // true
```
```
## Annotations
Annotations are metadata that are applied to classes that by themselves have no impact.
They, however, can provide user defined changes at runtime to given classes.
```cs
@Annotation
class AnnotatedClass {

}
```
Annotations are accessed via the `.annotations` property available on all classes. If annotations
are preset a dictionary is returned, otherwise the `.annotations` property is `nil`.
```cs
print(AnnotatedClass.annotations); // {"Annotation": nil}
```
Annotations can also be supplied a value, however, the value must be of type: nil, boolean, number or string.
```
@Annotation("Some extra value!")
class AnnotatedClass {

}

print(AnnotatedClass.annotations); // {"Annotation": "Some extra value!"}
```
Multiple annotations can be supplied to classes.
```cs
@Annotation
@AnotherAnnotation(10)
@SomeOtherAnnotation
class AnnotatedClass {

}
```
**Note**: Annotations are not available on methods.
18 changes: 18 additions & 0 deletions docs/docs/standard-lib/math.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,21 @@ Returns the tan value of a given number in radian
Math.tan(1); // 1.5574
Math.tan(50); // -0.2719
```

### Math.gcd(iterable)

Return the greatest common divisor of the numbers within the iterable

```cs
Math.gcd(32, 24, 12); // 4
Math.gcd([32, 24, 12]); // 4
```

### Math.lcm(iterable)

Return the least common multiple of the numbers within the iterable

```cs
Math.lcm(32, 24, 12); // 96
Math.lcm([32, 24, 12]); // 96
```
12 changes: 12 additions & 0 deletions docs/docs/standard-lib/path.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,15 @@ Returns a list of strings containing the contents of the input path.
```js
Path.listDir("/"); // ["bin", "dev", "home", "lib", ...]
```

### Path.join(iterable)

Returns the provided string arguments joined using the directory separator.

**Note:** A trailing directory separator is ignored from each argument

```js
Path.join('/tmp', 'abcd', 'efg') == '/tmp/abcd/efg';
Path.join(['/tmp', 'abcd', 'efg']) == '/tmp/abcd/efg';
Path.join('/tmp/', 'abcd/', 'efg/') == '/tmp/abcd/efg';
```
10 changes: 10 additions & 0 deletions docs/docs/strings.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,13 @@ Returns the number of occurrences of a given substring within another string.
"This documentation".count("Good jokes"); // 0
"Sooooooooooome characters".count("o"); // 11
```

### string.title()

Returns a title cased version of string with first letter of each word capitalized.

```cs
"dictu language".title(); // Dictu Language
"this documentation".title(); // This Documentation
"once upon a time".title(); // Once Upon A Time
```
12 changes: 11 additions & 1 deletion examples/factorial.du
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
var amount = input("Enter a number: ").toNumber().unwrap();
var amount;

/**
* This is to handle the case where the script is ran headless in the CI/CD pipeline.
*/
if (System.argv[0] == __file__) {
amount = input("Enter a number: ").toNumber().unwrap();
} else {
amount = 8;
}

var num = 1;

if (amount > 0) {
Expand Down
27 changes: 27 additions & 0 deletions examples/fibonacci.du
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
def iterative_fibonacci(n) {
var a = 0, b = 1, c = 0;
for (var i = 1; i < n; i += 1) {
c = a;
a = b;
b = b + c;
}
return b;
}

var memoization_dict = {};
def memoized_recursive_fibonacci(n) {
if (memoization_dict.exists(n)) return memoization_dict[n];
if (n < 2) return n;
var result = memoized_recursive_fibonacci(n - 2) + memoized_recursive_fibonacci(n - 1);
memoization_dict[n] = result;
return result;
}

def recursive_fibonacci(n) {
if (n < 2) return n;
return recursive_fibonacci(n - 2) + recursive_fibonacci(n - 1);
}

print('iterative_fibonacci(100) = {}'.format(iterative_fibonacci(100)));
print('memoized_recursive_fibonacci(100) = {}'.format(memoized_recursive_fibonacci(100)));
print('recursive_fibonacci(10) = {}'.format(recursive_fibonacci(10)));
Loading

0 comments on commit 82da2ce

Please sign in to comment.