-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
137 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Exports | ||
|
||
## Design | ||
|
||
Imports allow top-level-statements exported to other files. | ||
|
||
The syntax in Zep is like so | ||
|
||
```rust | ||
#[export]: alias-name | ||
fn add(a: i32, b: i32) -> i32 { | ||
rt a + b | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Imports | ||
|
||
## Design | ||
|
||
Imports allow top-level-statements to be accessed from other files. | ||
|
||
The syntax in Zep is like so | ||
|
||
```rust | ||
import "file.zp" as foo | ||
``` | ||
|
||
```rust | ||
import "file.zp" as { foo, bar, baz } | ||
|
||
foo(); | ||
bar(); | ||
baz(); | ||
``` | ||
|
||
If no `as` option is supplied, the exports are attached to the namespace of the file's name. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Loops | ||
|
||
## Design | ||
|
||
|
||
```rust | ||
#[extern]: env.print | ||
fn print(data: i32) -> none | ||
|
||
#[export]: main | ||
fn main() -> none { | ||
print(5) | ||
|
||
for i in 0..5 { | ||
print(i) | ||
} | ||
|
||
let numbers = [6, 7, 8, 9, 10] | ||
|
||
for num in numbers { | ||
print(num) | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Expression } from "./Expression.js"; | ||
|
||
export class BooleanLiteral extends Expression { | ||
public nameOf: string = "BooleanLiteral"; | ||
constructor( | ||
public value: boolean | ||
) { | ||
super(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { BlockExpression } from "./BlockExpression"; | ||
import { Expression } from "./Expression.js"; | ||
import { Statement } from "./Statement.js"; | ||
|
||
export class IfStatement extends Statement { | ||
public nameOf: string = "IfStatement"; | ||
public condition: Expression; | ||
public block: BlockExpression; | ||
constructor(condition: Expression, block: BlockExpression) { | ||
super(); | ||
this.condition = condition; | ||
this.block = block; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters