A verbose JavaScript superset that makes you yap a lot.
yap
is the extension for Yappacino. Example:main.yap
- Run the
./yap
executable in your working directory. - Check the
dist
folder created - it will contain yourmain.yap
, but rewritten tomain.js
. - In projects that expect JS code, set their source to
dist/main.js
instead ofmain.yap
. - Every time you modify
main.yap
& want to run it, you can run./yap && node dist/main.yap
If the yap
executable in Releases fails, please run bun src/backup/yapped_index.js
. For instructions on what the backup
folder is, please read the README.md
inside it!
Example:
unsynchronised constant variable num: Integer = 3;
synchronised constant variable PI: Integer = 3.1451;
volatile mutable variable str: Ligature = "";
stable mutable variable file_paths: Ligature = [];
Keyword | Example | Explanation |
---|---|---|
synchronised |
synchronised constant variable HOURS: Integer = 24; |
If during compilation another constant & synchronised variable gets the same value as HOURS, HOURS is now hooked (synchronised) to the changes of that variable. |
unsynchronised |
unsynchronised constant variable HOURS: Integer = 24; |
Normal constant variable. The above does not happen. |
volatile |
volatile mutable variable str: Ligature = ""; |
The variable is volatile - you are unsure if it's safe or not. Does not affect compilation. |
stable |
stable mutable variable file_paths: Ligature = []; |
Normal mutable variable. |
Yappacino uses a slightly different syntax for accessing object members.
- JavaScript: env.config()
+ Yappacino : ENV:\config()
- JavaScript: console.log()
+ Yappacino : C:\Standard\System\io\format\print\ln(arg)
- JavaScript: map.get("hello")
+ Yappacino : MAP:\get("hello")
- JavaScript: obj.fields.name
+ Yappacino : obj:\fields\name
Although the first word can be lowercase, we recommend you UPPERCASE them.
Example:
-> Integer independent invariable void function main(arg1, arg2, arg3 : Ligature, Integer, Ligature) {
C:\Standard\System\io\format\print\ln(arg)
return 0;
}
The arg types follow this pattern: [arguments] : [types]
.
Example:
arg : Ligature
path, amount : Ligature, Integer
Keyword | Example | Explanation |
---|---|---|
-> |
-> Integer , -> |
Specifies the return type. Similar to func main() -> Integer: from other programming languages. |
independent |
-> independent invariable void subroutine main() {} |
The function is independent - it cannot be called during the program. |
dependent |
-> dependent invariable void subroutine main() {} |
The function is dependent - the program uses it. |
invariable |
-> dependent invariable void subroutine main() {} |
The function cannot be set as the value of a variable. |
variable |
-> dependent variable void subroutine main() {} |
You can set the function as the value of a variable. |
subroutine |
-> dependent variable void subroutine main() {} |
A subroutine is a function that doesn't return anything. |
Example:
transient classification Person {
extemporize(name : Ligature) {
aforementioned.name = name;
}
-> Integer dependent invariable void async subroutine greet ? (){
C:\Standard\System\io\format\print\ln("buzz")
}
}
Keyword | Example | Explanation |
---|---|---|
transient |
transient classification Person {} |
Makes me class be allowed to be initialised only once. Optional |
extemporize |
extemporize(name) {} |
Similar to JavaScript's constructor . |
? |
-> dependent invariable void subroutine main() ? {} |
The function is inside a class, therefore it must be suffixed with ? . |
aforementioned |
aforementioned.name |
Similar to JavaScript's aforementioned . |
Yappacino introduces a new type of loop - towards
towards(i within 0..10){}
Which, in JavaScript, would look something like
for(let i = 0; i < 10; i++){}
Yappacino introduces a new type of switch - compeer
.
compeer number {
1 => C:\Standard\System\io\format\print\ln("One!"),
2 | 3 | 5 | 7 | 11 => {
C:\Standard\System\io\format\print\ln("This is a prime")
C:\Standard\System\io\format\print\ln("lmfao")
},
nonfulfillment => {
C:\Standard\System\io\format\print\ln("Ain't special")
}
}
Which, in JavaScript, would look something like
switch (number) {
case 1:
console.log("One!");
case 2:
case 3:
case 5:
case 7:
case 11: {
console.log("This is a prime")
console.log("lmfao")
}
default: {
console.log("Ain't special")
}
}
Types are purely visual. They help you, the developer, remember what the variable's value should've been. Types don't do anything.
stable mutable variable PI: Integer = 3.1451;
Available types are Integer, Ligature* and NovemHeader*. You can still set any type, these are just the ones that will be collected by Yappacino in case we decide to support types in the future.
- *Ligature is a string.
- *NovemHeader is a boolean. It supports
true
,false
,neither
,maybe
,both
,trueish
,falseish
,depends
,complicated
.- Yes, this means you can
if (response.status === maybe)
.
- Yes, this means you can
JavaScript | Yappacino |
---|---|
new |
epitomise |
class |
classification |
constructor |
extemporize |
if |
stipulate |
else |
otherwise |
import |
connotate |
from |
derives |
console.log |
C:\Standard\System\io\format\print\ln |
There's an /examples
folder! You can view Yappacino being used to spin a donut, create a website, and other!
It isn't! Yappacino is written in Yappacino! Take a look at src/index.yap
GitHub doesn't recognise .yap
as a valid programming language :)