Skip to content
This repository has been archived by the owner on Aug 28, 2022. It is now read-only.

Commit

Permalink
chore: ease up used tooling
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinHelmut committed Feb 4, 2019
1 parent e48ca18 commit b6e3401
Show file tree
Hide file tree
Showing 50 changed files with 8,406 additions and 8,426 deletions.
14 changes: 3 additions & 11 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true

[{*.{json,js,css},.*rc}]
charset = utf-8
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[package.json]
charset = utf-8
indent_style = space
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
18 changes: 10 additions & 8 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
"use strict";

module.exports = {
extends: ['google', 'prettier'],
plugins: ['prettier'],
parserOptions: {
ecmaVersion: 2017
},
rules: {
'prettier/prettier': 'error'
}
extends: ["google", "prettier"],
plugins: ["prettier"],
parserOptions: {
ecmaVersion: 2017
},
rules: {
"prettier/prettier": "error"
}
};
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
language: node_js
node_js:
- 'node'
- 8
- "10"
- 8
install:
- npm install
- npm install
script:
- npm run lint
- npm test -- --ensure
- npm run lint
- npm test -- --ensure
20 changes: 10 additions & 10 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ In the interest of fostering an open and welcoming environment, we as contributo

Examples of behavior that contributes to creating a positive environment include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting
- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Expand Down
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ You want do something for this repo? Nice and easy! And of course: you are the b

If you report a bug, please try to:

- Perform a web / GitHub search to avoid creating a duplicate ticket.
- Include enough information to reproduce the problem.
- Mention the exact version of the project causing you problems, as well as any related software and versions (such as operating system, browser, etc.).
- Test against the latest version of the project (and if possible also the master branch) to see if the problem has already been fixed.
- Perform a web / GitHub search to avoid creating a duplicate ticket.
- Include enough information to reproduce the problem.
- Mention the exact version of the project causing you problems, as well as any related software and versions (such as operating system, browser, etc.).
- Test against the latest version of the project (and if possible also the master branch) to see if the problem has already been fixed.

Once you have tried the above, create a GitHub issue notifying your bug report.

## Working in the code

If you want to contribute code, please:

- Write [good commit messages](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html), explain what your patch does, and why it is needed. How to is described in the [Commit changes chapter](#commit-changes).
- Keep it simple: Any patch that changes a lot of code or is difficult to understand should be discussed before you put in the effort.
- Write [good commit messages](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html), explain what your patch does, and why it is needed. How to is described in the [Commit changes chapter](#commit-changes).
- Keep it simple: Any patch that changes a lot of code or is difficult to understand should be discussed before you put in the effort.

Once you have tried the above, create a GitHub pull request with your changes changes and feel awesome 🎉.

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ The _StrexLang_ ("Strange expression language") is only used to train regular ex

## Contents

- [Goal](#goal)
- [Language](#language)
- [How to start](#how-to-start)
- [Installation](#installation)
- [Start development](#start-development)
- [Phases](#phases)
- [Goal](#goal)
- [Language](#language)
- [How to start](#how-to-start)
- [Installation](#installation)
- [Start development](#start-development)
- [Phases](#phases)

---

Expand Down
204 changes: 102 additions & 102 deletions docs/language.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
## Language

- [Language](#language)
- [Example](#example)
- [Features](#features)
- [AST](#ast)
- [Language](#language)
- [Example](#example)
- [Features](#features)
- [AST](#ast)

---

Expand All @@ -30,25 +30,25 @@ _StrexLang_ is a very small language without any functions. It contains of expre

#### Types

- **Signed and unsigned integer** (e.g. `-3`, `0`, `23`)
- Can be used as literal
- **Signed and unsigned float** (e.g. `-3.2`, `0.1`, `23.9`)
- Can be used as literal
- **Implicit boolean** (`true` and `false`)
- Can not be used as literal
- Is only be used for compare results in `if`-statements
- **Signed and unsigned integer** (e.g. `-3`, `0`, `23`)
- Can be used as literal
- **Signed and unsigned float** (e.g. `-3.2`, `0.1`, `23.9`)
- Can be used as literal
- **Implicit boolean** (`true` and `false`)
- Can not be used as literal
- Is only be used for compare results in `if`-statements

#### Operator

- `+` - Math operator for addition (works with Integer and Float)
- `-` - Math operator for subtraction (works with Integer and Float)
- `*` - Math operator for multiplication (works with Integer and Float)
- `/` - Math operator for division (works with Integer and Float)
- `|` - "Or" (alternate/pipe) operator (works with implicit boolean)
- `&` - "And" (consequent) operator (works with implicit boolean)
- `=` - Equals operator (works with Integer and Float to compare value)
- `>` - Greater-than operator (works with Integer and Float to compare value)
- `<` - Less-than operator (works with Integer and Float to compare value)
- `+` - Math operator for addition (works with Integer and Float)
- `-` - Math operator for subtraction (works with Integer and Float)
- `*` - Math operator for multiplication (works with Integer and Float)
- `/` - Math operator for division (works with Integer and Float)
- `|` - "Or" (alternate/pipe) operator (works with implicit boolean)
- `&` - "And" (consequent) operator (works with implicit boolean)
- `=` - Equals operator (works with Integer and Float to compare value)
- `>` - Greater-than operator (works with Integer and Float to compare value)
- `<` - Less-than operator (works with Integer and Float to compare value)

#### Calculation

Expand Down Expand Up @@ -109,95 +109,95 @@ the resulting AST would look like the following (defined as JSON):

```json
{
"body": [
{
"type": "BinaryExpression",
"left": {
"type": "IntegerLiteral",
"value": "4"
},
"right": {
"type": "IntegerLiteral",
"value": "3"
},
"operator": "+"
"body": [
{
"type": "BinaryExpression",
"left": {
"type": "IntegerLiteral",
"value": "4"
},
"right": {
"type": "IntegerLiteral",
"value": "3"
},
"operator": "+"
},
{
"type": "IfExpression",
"test": {
"type": "BooleanExpression",
"left": {
"type": "LastExpression"
},
"right": {
"type": "IntegerLiteral",
"value": "7"
},
{
"type": "IfExpression",
"test": {
"type": "BooleanExpression",
"left": {
"type": "LastExpression"
},
"right": {
"type": "IntegerLiteral",
"value": "7"
},
"operator": "="
},
"consequent": {
"type": "BinaryExpression",
"left": {
"type": "LastExpression"
},
"right": {
"type": "IntegerLiteral",
"value": "5"
},
"operator": "+"
},
"alternate": {
"type": "BinaryExpression",
"left": {
"type": "LastExpression"
},
"right": {
"type": "IntegerLiteral",
"value": "4"
},
"operator": "-"
}
"operator": "="
},
"consequent": {
"type": "BinaryExpression",
"left": {
"type": "LastExpression"
},
{
"type": "BinaryExpression",
"left": {
"type": "LastExpression"
},
"right": {
"type": "IntegerLiteral",
"value": "2"
},
"operator": "-"
"right": {
"type": "IntegerLiteral",
"value": "5"
},
{
"type": "PrintOut"
}
]
"operator": "+"
},
"alternate": {
"type": "BinaryExpression",
"left": {
"type": "LastExpression"
},
"right": {
"type": "IntegerLiteral",
"value": "4"
},
"operator": "-"
}
},
{
"type": "BinaryExpression",
"left": {
"type": "LastExpression"
},
"right": {
"type": "IntegerLiteral",
"value": "2"
},
"operator": "-"
},
{
"type": "PrintOut"
}
]
}
```

Step by step the AST is defined as follows. It starts with the actual program body without any comments:

```json
{
"body": []
"body": []
}
```

The `body` array contains any defined statement and expression of the program line by line. Where the first is the definition for an expression:

```json
{
"type": "BinaryExpression",
"left": {
"type": "IntegerLiteral",
"value": "4"
},
"right": {
"type": "IntegerLiteral",
"value": "3"
},
"operator": "+"
"type": "BinaryExpression",
"left": {
"type": "IntegerLiteral",
"value": "4"
},
"right": {
"type": "IntegerLiteral",
"value": "3"
},
"operator": "+"
}
```

Expand Down Expand Up @@ -249,23 +249,23 @@ The next line uses the last expression as left hand to assign the operator `-` w

```json
{
"type": "BinaryExpression",
"left": {
"type": "LastExpression"
},
"right": {
"type": "IntegerLiteral",
"value": "2"
},
"operator": "-"
"type": "BinaryExpression",
"left": {
"type": "LastExpression"
},
"right": {
"type": "IntegerLiteral",
"value": "2"
},
"operator": "-"
}
```

The last statement is the "empty line" that results in a print out to the stdout:

```json
{
"type": "PrintOut"
"type": "PrintOut"
}
```

Expand Down
Loading

0 comments on commit b6e3401

Please sign in to comment.