Skip to content

Instantly share code, notes, and snippets.

@ducc
Last active Mar 15, 2019
Embed
What would you like to do?
ducclang with js syntax formatting

ducclang is a revolutionary lang!!!!!!

its based on arrays embedded in arrays

simple program

[
    "hello world"
]

this program is just a string that says hello world. it is now at location [0]

definitions

assuming x is an integer..

[]

an array

,

array item seperator

[0]

getting item 0 from array

>[
    code here
]

function

[x]>[stuff here]

function invocation

[x..x]>[ // for i in 1 to 10
    [x]?    // i
]

for loop

[x]...

vararg spread

["standard.ducc", std]

importing standard.wglc as std

// Standard library:
[
>[
// prints to system output stream
],
>[
[0]>[[1]...,"\n"],
],
],
// dog.ducc
[
["standard.ducc", std],
0,
>[
std[1]>["bark"],
[1]=[1]+1
],
],
// main.ducc
[
["standard.ducc", std],
["dog.ducc", dog],
[
6,
>[
std[1]>["hello ", [1][1][0], " number ", [1][1][1], "!"],
],
],
[1..[1][0]]>[
[1][1]>["bob", [2]?],
],
>[
<[[3][0] + [3][1]],
],
[[1][0] >= 8]>[
std[1]>[[1][0], " is bigger than or equal to 8"],
]>[
std[1]>[[1][0], " is not bigger than or equal to 8"],
],
[dog],
[0..3]>[
[6][2]>
]
std[1]>["barks: ", [6][1]]
],
// Output:
"hello bob number 1"
"hello bob number 2"
"hello bob number 3"
"hello bob number 4"
"hello bob number 5"
"hello bob number 6"
"bark"
"bark"
"bark"
"bark"
"barks: 4"
// Equivelent code in JS
var iterations = 6;
function hello(name, number) {
console.log("hello " + name + " number " + number + "!");
}
for (var i = 1; i < iterations; i++) {
hello("bob", i);
}
function add(a, b) {
return a + b;
}
if (x >= 8) console.log(i + " is bigger than or equal to 8");
else console.log(i + " is not bigger than or equal to 8");
var dog = new Dog();
for (var z = 0; z <= 3; z++) {
dog.bark();
}
console.log("barks: " + dog.barks");
@minemidnight
Copy link

minemidnight commented Apr 6, 2017

how to ducc

@ducc
Copy link
Author

ducc commented Apr 6, 2017

quacc

@ArsenArsen
Copy link

ArsenArsen commented Apr 6, 2017

am i ducc

@nikammerlaan
Copy link

nikammerlaan commented Mar 10, 2018

dumb fat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment