WienerScript/README.md

132 lines
3.3 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
```
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 |
2020-06-29 20:13:32 +01:00
| OWIZAHRA | async |
2020-06-29 20:07:57 +01:00
| 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-30 05:24:58 +01:00
| WOS WÜSTN | if |
2020-06-29 20:07:57 +01:00
| 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 | = |
2020-06-29 20:19:16 +01:00
| ANS AUFI | ++ |
2020-06-27 03:11:41 +01:00
| AUFI | + |
2020-06-29 20:19:57 +01:00
| ANS OWI | -- |
2020-06-27 03:11:41 +01:00
| OWI | - |
| HAUTS EICH ZAM | * |
| BRÖCKERL | / |
| S'RESTL | % |
2020-06-29 20:19:16 +01:00
| WENGA | < |
| GRESSA | > |
2020-06-30 01:30:31 +01:00
| HOIT NET GRESSA | <= |
| HOIT NET KLANA | >= |
2020-06-27 03:11:41 +01:00
| JO EH | ! |
| HOST MI | ? |
| DANN HOIT NET | : |
2020-06-30 01:30:31 +01:00
| HUACH ZUA | => |
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-30 07:11:02 +01:00
| HEAST | alert |
2020-06-27 23:33:17 +01:00
## License
2020-06-30 01:34:41 +01:00
This project is licensed under the MIT license, Copyright (c) 2020 David Pichsenmeister | [pichsenmeister.com](https://pichsenmeister.com). For more information see [LICENSE](LICENSE).
2020-06-27 23:33:17 +01:00
2020-06-30 02:15:54 +01:00
Made by [@pichsenmeister](https://twitter.com/pichsenmeister). Inspired by [ArnoldJS](https://github.com/theBrianCui/ArnoldJS).