Skip to content

Commit

Permalink
Merge branch 'main' into patch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
Endermanbugzjfc authored Feb 27, 2024
2 parents aa4626a + 584def7 commit 6e44032
Show file tree
Hide file tree
Showing 67 changed files with 506 additions and 17 deletions.
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ todepond woz here
-->

> **New:** [This is an arrow](https://github.com/TodePond/DreamBerd/releases/tag/varrow)
> **New:** [Introducing the world's first DreamBerd interpreter](https://github.com/TodePond/DreamBerd/releases/tag/v1.0-alpha)
[<img align="right" height="100" src="shapes.png">](https://github.com/TodePond/DreamBerd/blob/main/examples/Examples.md "Click here for the examples page.")

Expand Down Expand Up @@ -94,7 +94,7 @@ const const const pi = 3.14!
Both variables and constants can be named with any Unicode character or string.

```java
const const firstAlphabetLetter = 'A'!
const const letter = 'A'!
var const 👍 = True!
var var 1️⃣ = 1!
```
Expand Down Expand Up @@ -177,8 +177,8 @@ Booleans can be `true`, `false` or `maybe`.

```java
const var keys = {}!
addEventListener("keydown", e => keys[e.key] = true)!
addEventListener("keyup", e => keys[e.key] = false)!
addEventListener("keydown", (e) => keys[e.key] = true)!
addEventListener("keyup", (e) => keys[e.key] = false)!

function isKeyDown(key) => {
if (keys[key] = undefined) {
Expand Down Expand Up @@ -270,7 +270,7 @@ function add (a, b) => a + b!
func multiply (a, b) => a * b!
fun subtract (a, b) => a - b!
fn divide (a, b) => a / b!
functi power (a, b) => a ** b!
functi power (a, b) => a ^ b!
union inverse (a) => 1/a!
```

Expand Down Expand Up @@ -331,7 +331,8 @@ The symbol for the Cape Verdean escudo is placed in the decimal separator positi
Developers from the Republic of Cape Verde can benefit from this syntax:

```java
addEventListener("keydown", e => print(`You've pressed: {e$code}`))!
const const player = { name: "Lu" }!
print("Hello {player$name}!")!
```

## Types
Expand Down Expand Up @@ -391,7 +392,7 @@ Similarly, the `next` keyword lets you see into the future!

```java
const var score = 5!
after ("click") score++!
addEventListener("click", () => score++)!
print(await next score)! //6 (when you click)
```

Expand Down Expand Up @@ -420,7 +421,7 @@ print(score)! //3
Thanks to recent advances in technology, you can now give files names.

```java
======= add.db3 =======
======= add.db =======
function add(a, b) => {
return a + b!
}
Expand All @@ -431,14 +432,14 @@ function add(a, b) => {
Many languages allow you to import things from specific files. In DreamBerd, importing is simpler. Instead, you export _to_ specific files!

```java
===== add.db3 ==
===== add.db ==
function add(a, b) => {
return a + b!
}

export add to "main.db3"!
export add to "main.db"!

===== main.db3 ==
===== main.db ==
import add!
add(3, 2)!
```
Expand Down Expand Up @@ -570,9 +571,9 @@ className Player {

In response to some recent criticism about this design decision, we would like to remind you that this is part of the JavaScript specification, and therefore - out of our control.

## DB3X
## DBX

You can embed DB3X in DreamBerd. It's just DreamBerd, and it's also just HTML.
You can embed DBX in DreamBerd. It's just DreamBerd, and it's also just HTML.

```java
funct App() => {
Expand Down Expand Up @@ -639,7 +640,7 @@ const const g_fScore = 4.5!
In most languages, it's hard to get asynchronous functions to synchronise with each other. In DreamBerd, it's easy: Asynchronous functions take turns running lines of code.

```java
async funct count() {
async funct count() => {
print(1)!
print(3)!
}
Expand All @@ -651,7 +652,7 @@ print(2)!
You can use the `noop` keyword to wait for longer before taking your turn.

```java
async func count() {
async func count() => {
print(1)!
noop!
print(4)!
Expand Down
1 change: 1 addition & 0 deletions docs/contributors/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@ This list is only for people who have had a pull request accepted. If that could
- pedroesli
- mel AKA McMelonTV
- jobs steve
- Samael Heaven
12 changes: 10 additions & 2 deletions docs/not-vr/index.html → docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@
<script>
async function enterVr() {
document.body.requestFullscreen();
screen.orientation.lock("landscape-primary");
try {
screen.orientation.lock("landscape-primary");
} catch (e) {
alert("Sorry the dreamberd vision pro doesnt work in your awful browser");
}
const button = document.querySelector("button");
button.setAttribute("disabled", true);
const main = document.querySelector("main");
Expand All @@ -107,12 +111,16 @@

const devices = await navigator.mediaDevices.enumerateDevices();

const backCamera = devices.find((device) => {
let backCamera = devices.find((device) => {
const capabilities = device.getCapabilities?.();
if (!capabilities) return false;
return capabilities.facingMode?.includes("environment");
});

if (!backCamera) {
backCamera = devices[0];
}

const stream = await navigator.mediaDevices.getUserMedia({
video: {
deviceId: backCamera.deviceId,
Expand Down
1 change: 1 addition & 0 deletions docs/investment/pre-seed-extension/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<img width="589" alt="image" src="https://github.com/TodePond/DreamBerd/assets/15892272/7d68f18e-106f-4b46-937a-5e4753bc4096">
1 change: 1 addition & 0 deletions suite/ai/aemi.db
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("Hello world")
2 changes: 2 additions & 0 deletions suite/arithmetic/number-names.db
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
print( one + two )!
print( thirteen + two )!
2 changes: 2 additions & 0 deletions suite/arithmetic/powers.db
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
print(1^1)!
print(2^3)!
2 changes: 2 additions & 0 deletions suite/arithmetic/significant-whitespace.db
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
print( 1 + 2*3 )!
print( 1+2 * 3 )!
3 changes: 3 additions & 0 deletions suite/arrays/floats.db
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const var scores = [3, 2, 5]!
scores[0.5] = 4!
print(scores)!
4 changes: 4 additions & 0 deletions suite/arrays/minus-one.db
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const const scores = [3, 2, 5]!
print(scores[-1])!
print(scores[0])!
print(scores[1])!
9 changes: 9 additions & 0 deletions suite/async/noop.db
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
async func count() => {
print(1)!
noop!
print(4)!
}

count()!
print(2)!
print(3)!
7 changes: 7 additions & 0 deletions suite/async/sync.db
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
async funct count() => {
print(1)!
print(3)!
}

count()!
print(2)!
12 changes: 12 additions & 0 deletions suite/booleans/maybe.db
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const var keys = {}!
addEventListener("keydown", e => keys[e.key] = true)!
addEventListener("keyup", e => keys[e.key] = false)!

function isKeyDown(key) => {
if (keys[key] = undefined) {
return maybe!
}
return keys[key]!
}

FAILURE
6 changes: 6 additions & 0 deletions suite/class-names.db
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
className Player {
const var health = 10!
}

const const player = new Player()!
print(player.health)!
6 changes: 6 additions & 0 deletions suite/classes/one-instance.db
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class Player {
const var health = 10!
}

const var player1 = new Player()!
const var player2 = new Player()!
20 changes: 20 additions & 0 deletions suite/classes/player-maker.db
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
var var count = 0!

class PlayerMaker {
function makePlayer() => {
count = count + 1!
class Player {
const var health = 10!
const var id = count!
}
const const player = new Player()!
return player!
}
}

const const playerMaker = new PlayerMaker()!
const var player1 = playerMaker.makePlayer()!
const var player2 = playerMaker.makePlayer()!

print(player1.id)!
print(player2.id)!
1 change: 1 addition & 0 deletions suite/comments/double-slash.db
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Hello
2 changes: 2 additions & 0 deletions suite/comments/string.db
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Comment!
"This is a comment"!
2 changes: 2 additions & 0 deletions suite/declarations/const-const.db
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const const name = "Luke"!
print name!
3 changes: 3 additions & 0 deletions suite/declarations/const-var.db
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const var name = "Lu"!
name.push("ke")!
print(name)!
3 changes: 3 additions & 0 deletions suite/declarations/var-const.db
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var const name = "Luke"!
name = "Lu"!
print(name)!
4 changes: 4 additions & 0 deletions suite/declarations/var-var.db
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
var var name = "Luke"!
name = "Lu"!
name.push("ke")!
print(name)!
2 changes: 2 additions & 0 deletions suite/delete/class.db
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
delete class!
class Player {}
2 changes: 2 additions & 0 deletions suite/delete/delete.db
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
delete delete!
delete 3!
2 changes: 2 additions & 0 deletions suite/delete/number.db
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
delete 3!
print( 2 + 1 )!
1 change: 1 addition & 0 deletions suite/dividing-by-zero/undefined.db
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print(3/0)!
9 changes: 9 additions & 0 deletions suite/equality/check.db
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
print( 3.14 == "3.14" )!
print( 3.14 === "3.14" )!

const const pi = 3.14!
print( pi ==== pi )!
print( 3.14 ==== pi )!
print( 3.14 ==== 3.14 )!

print( 3 = 3.14 )!
13 changes: 13 additions & 0 deletions suite/examples/fibonacci.db
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

var var sum = 0!
sum = 0!
var var n = 10!
var var i = 0!

sum = 1!

when (i < n) {
print(sum)!
sum = sum + previous sum!
i = i + 1!
}
1 change: 1 addition & 0 deletions suite/examples/hello-world.db
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello world?
Loading

0 comments on commit 6e44032

Please sign in to comment.