This repository is the home of Midi-Chlorian, a language inspired by the mind of George Lucas. One of our team members had just finished five hours of reading Star Wars wiki articles, and proposed the name SkywalkerScript. After a bit of deliberation, our team settled on Midi-Chlorian, named after the "intelligent microscopic life-forms that lived symbiotically inside the cells of all living things"[1].
Midi-Chlorian is created by Carter Pon, Adrian Leung, Isaiah Anyimi, and Jason Kalili.
Type in Javascript | Midi-chlorian | Declaration |
---|---|---|
int | cred | Cred a = 9 |
long | parsec | Parsec b = 900000 |
double | ket | ket c = 0.5 |
boolean | absolute | absolute d = true |
char | midichlorian | midichlorian e = "s" |
string | transmission | transmission f = "Hello There" |
array | tome | tome<transmission> g = ["Execute","Order","66"] |
dictionary | holocron | holocron<transmission,cred> g = [exe:34, evc: 32] |
Javascript | Midi-chlorian |
---|---|
true | light |
false | dark |
Javascript | Midi-chlorian |
---|---|
a + b | a + b |
a - b | a - b |
a _ b | a _ b |
a / b | a / b |
a * b | a * b |
a % b | a % b |
a == b | a oneWith b |
a != b | a !oneWith b |
a > b | a > b |
a < b | a < b |
a <= b | a <= b |
a && b | a and b |
a or b | a or b |
Operation | Compatability |
---|---|
increment: ++ |
Numbers |
decrement: -- |
Numbers |
negative: - |
Numbers |
negation: darth |
Booleans |
- Single Line:
>< comment goes here
- Block:
>> comment goes here <<
emit ("May the force be with you.")
cred numberOfSith = 9
should (i > j) {
execute i
} orElse {
execute j
}
force (cred i = 0; i < 5; i++) {
should (i onewith 3) {
unleash >< break from loop
}
}
while (i < 3) {
unleash >< break from loop
}
function fibonacci (n) {
if (n <= 1) {
return 1
}
return fibonacci(n-1) + fibonacci(n-2)
}
Order fibonacci (cred count) {
should (count <= 1) {
execute 1
}
execute fibonacci(n-1) + fibonacci(n-2)
}
function max (i, j) {
if (i > j) {
return i
} else {
return j
}
}
order max (cred i, cred j) {
should (i > j) {
execute i
} elseshould {
execute j
}
}
function twoSum(nums, target) {
const comp = {};
for (let i = 0; i < nums.length; i++) {
if (comp[nums[i]] >= 0) {
return [comp[nums[i]], i]
}
comp[target-nums[i]] = i
}
}
order cred twoSum (tome nums, cred target) {
const comp = {};
cred i = 0;
force (i until nums.length) {
should (comp[nums[i]] >= 0) {
execute [comp[nums[i]], i]
}
comp[target-nums[i]] = i
}
}