Skip to content

Commit

Permalink
add links to examples
Browse files Browse the repository at this point in the history
  • Loading branch information
antonkesy committed Mar 18, 2024
1 parent 1682f94 commit 8af31b9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 11 deletions.
34 changes: 23 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The missing link between C and Python

C style syntax with Python like runtime interpretation and built in functions.

### Main
### [Main](./examples/main_hello_world.mmm)

Main function `void main() {}` is the entry point.

Expand All @@ -26,21 +26,21 @@ Alternately, statements are executed from top to bottom in case no main is found
print("Hello, World!");
```

### Primitives
### [Primitives](./examples/primitives.mmm)

- void
- bool
- int
- float
- str

### Conversion
### [Conversion](./examples/primitives.mmm)

- `str(1)` -> `"1"`
- `int("1")` -> `1`
- `float("1.3")` -> `1.3`

#### Operations
#### [Operations](./examples/primitives.mmm)

There is no operator precedence

Expand All @@ -60,7 +60,7 @@ There is no operator precedence
| && | x ||| x | x |
| \|\| | x ||| x | x |

### Flow Control
### [Flow Control](./examples/control.mmm)

If:

Expand All @@ -82,7 +82,7 @@ while j < 10 {
}
```

### Functions
### [Functions](./examples/functions.mmm)

```
int f() {
Expand All @@ -94,7 +94,7 @@ void main() {
}
```

### Structs
### [Structs](./examples/structs.mmm)

```
struct T {
Expand All @@ -106,11 +106,11 @@ T t;
t.x = 2;
```

### Built In
### [Built In](./examples/hello_input.mmm)

- print -> prints
- println -> prints line
- input -> reads stdin
- print -> prints string without buffering
- println -> print + appends newline at the end
- input -> reads stdin and outputs str

## Limitations & Issues

Expand All @@ -120,6 +120,18 @@ t.x = 2;
- bad error messages from parser and interpreter
- types are optional and currently not always strictly enforced

## Missing/Planned Features

- Arrays
- Classes (or something similar)
- String manipulation
- Multiple files support
- Enums
- Pattern matching
- switch
- for
- define grammar

## Installation

### Native
Expand Down
3 changes: 3 additions & 0 deletions examples/primitives.mmm
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ if 1 > int("0") {
if 1 < int(3.2) {
println("smaller")
}

i = i + 5;
println(str(i));

0 comments on commit 8af31b9

Please sign in to comment.