WienerScript/README.md

130 lines
3.1 KiB
Markdown
Raw Normal View History

2020-06-27 03:12:48 +01:00
# WienerScript
2020-06-27 03:11:41 +01:00
2020-06-27 03:12:48 +01:00
```
2020-06-27 03:11:41 +01:00
HACKL AMOI WOS calc(operator, left, right) {
WOS IS MIT DIR (operator) {
I SCHAU NUR '+':
DRAH DI HAM left AUFI right
I SCHAU NUR '-':
DRAH DI HAM left OWI right
I SCHAU NUR '*':
DRAH DI HAM left HAUTS EICH ZAM right
I SCHAU NUR '/':
DRAH DI HAM left BRÖCKERL right
NA GEH:
2020-06-27 05:08:56 +01:00
GEH SCHEISSN 'invalid operator'
2020-06-27 03:11:41 +01:00
}
}
SCHAU MA MOL {
I MAN JA NUR (calc('+', 1, 2))
} LECK OASCH (err) {
GSCHISSN GRISSN ('invalid operation')
}
2020-06-27 03:12:48 +01:00
```
2020-06-27 03:11:41 +01:00
WienerScript adds syntactic sugar to JavaScript that makes it less forgiving, more emotional, and even painful to write, allowing you to do less with more code.
Common Viennese phrases and words act as intuitive replacements for common JavaScript keywords, operators, and more. You can continue to use raw JavaScript inside WienerScript, and the `wienerscript` transpiler will convert WienerScript code into raw JavaScript.
2020-06-27 03:12:48 +01:00
### Installation
2020-06-27 03:11:41 +01:00
WienerScript requires [Node.js and npm](https://nodejs.org/en/).
```
npm install -g wienerscript
```
2020-06-27 23:34:47 +01:00
or
```
yarn add global wienerscript
```
2020-06-27 03:11:41 +01:00
Usage:
```
wienerscript
```
All files in that directory (and any subdirectories) that have a valid WienerScript file extensions (`.ws`) will be replaced by the transpiled contents of in the `/dist` directory.
2020-06-27 23:33:17 +01:00
Input files conventionally use the `.ws` extension and output files conventionally use the `.js` extension.
Examples can be found in the [examples](examples) directory.
2020-06-27 03:11:41 +01:00
2020-06-27 03:12:48 +01:00
### Usage
2020-06-27 03:11:41 +01:00
2020-06-29 20:07:57 +01:00
#### Keywords
2020-06-27 03:11:41 +01:00
| WienerScript | JavaScript |
| ----- | ----- |
| FIX OIDA | const |
| OIDA | let |
| ALSO DES IS AMOI NIX | null |
| HAWIDERE | new |
| I BIMS | this |
| HACKL AMOI WOS | function |
2020-06-29 20:07:57 +01:00
| SCHLEICH DI | delete |
| SICHA NET | false |
| NA NO NA NET | true |
| WOS BISTN DU FIA A WAPPLA | instanceof |
| WEM GHERSTN DU | typeof |
| JO GLEI | await |
| OWIZAHRER | async |
| AIZAL | in |
#### Control statements
| WienerScript | JavaScript |
| ----- | ----- |
| STRAWANZ MA | for |
2020-06-27 03:11:41 +01:00
| DAMMA WOS | do |
| GEMMA | while |
| GUSCH | continue |
2020-06-29 20:07:57 +01:00
| WAS WÜSTN | if |
| WOA NUA A SCHMÄH | else if |
| A SCHO WUASCHT | else |
2020-06-27 03:11:41 +01:00
| WOS IS MIT DIR | switch |
| I SCHAU NUR | case |
| PASST SCHO | break |
| NA GEH | default |
2020-06-29 20:07:57 +01:00
| DRAH DI HAM | return |
2020-06-27 03:11:41 +01:00
| GEH SCHEISSN | throw |
| SCHAU MA MOL | try |
| LECK OASCH | catch |
| SAMMAS ENDLICH | finally |
2020-06-29 20:07:57 +01:00
#### Operators
| WienerScript | JavaScript |
| ----- | ----- |
2020-06-27 03:11:41 +01:00
| KANNST DA VUASTÖHN | === |
| DES GEHT SI SCHO AUS | == |
2020-06-29 20:07:57 +01:00
| UND ÜBRIGENS | && |
2020-06-27 03:14:01 +01:00
| GHUPFT WIE GHATSCHT | \|\| |
2020-06-27 03:11:41 +01:00
| WENNST MANST | = |
| AUFI | + |
| OWI | - |
| HAUTS EICH ZAM | * |
| BRÖCKERL | / |
| S'RESTL | % |
| JO EH | ! |
| HOST MI | ? |
| DANN HOIT NET | : |
2020-06-27 23:33:17 +01:00
2020-06-29 20:07:57 +01:00
#### Functions
| WienerScript | JavaScript |
| ----- | ----- |
| I MAN JA NUR | console.log |
| DO IS DA HUND BEGROBN | console.debug |
| GSCHISSN GRISSN | console.error |
| DES IS MA ECHT Z'DEPPAT | process.exit |
2020-06-27 23:33:17 +01:00
## License
This project is licensed under the MIT license, Copyright (c) 2020 David Pichsenmeister | pichsenmeister.com. For more information see [LICENSE](LICENSE).
2020-06-29 20:07:57 +01:00
Inspired by [ArnoldJS](https://github.com/pichsenmeister/ArnoldJS)