Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
m3rashid committed Feb 9, 2024
1 parent bc759b6 commit 5122ddc
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 3 deletions.
98 changes: 96 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
## Lol Lang
## lol lang

Lol lang is an assembly style interpreted language with its syntax inspired from assembly

- Currently works only with integers
- supports the following features
- Refer the `examples` folder for code examples

<br />
<img src="./examples/lol.png" height="400" />
<br />

| Feature | Description |
| --------- | ------------------------------------------------- |
| PUSH | Push to the stack |
Expand All @@ -21,9 +25,99 @@ Lol lang is an assembly style interpreted language with its syntax inspired from
## Usage

```bash
# download the binary release from the releases page
# or just clone the repo and build the project

# build the project
make build

# run the project
# execute your lol program
bin/lol <file_name>.lol
```

## Examples

as given in the `examples` folder

```bash
# example.lol
PRINT "hello world"
HALT

# result
hello world
```

```bash
# example.lol
PRINT "enter first number"
READ
PRINT "enter second number"
READ
SUB
JUMP.EQ.0 L1
PRINT "not equal"
HALT

L1:
PRINT "equal"
HALT

# result
enter first number
12
enter second number
12
equal
```

```bash
# example.lol
PUSH 232
PUSH 1
ADD
JUMP.EQ.0 L1

LOOP:
PUSH 2
SUB
JUMP.EQ.0 L1
JUMP.GT.0 LOOP
PRINT "even"
HALT

L1:
PRINT "odd"
HALT

# result
even
```

```bash
# example.lol
PUSH 69
JUMP.EQ.0 L2
JUMP.GT.0 L0
PRINT "A"
HALT

L0:
PUSH 3
SUB
JUMP.EQ.0 L1
JUMP.GT.0 L0
PRINT "B"
HALT

L1:
PRINT "C"
HALT

L2:
PRINT "D"
HALT

# result
C
```
1 change: 0 additions & 1 deletion examples/1.lol
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
PRINT "hello world"
HALT

Binary file added examples/lol.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5122ddc

Please sign in to comment.