Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dropdevrahul/hollow
A simple programming language
https://github.com/dropdevrahul/hollow
assembly c compiler-design go golang language-design parser programming-language
Last synced: 2 days ago
JSON representation
A simple programming language
- Host: GitHub
- URL: https://github.com/dropdevrahul/hollow
- Owner: dropdevrahul
- Created: 2023-02-01T10:17:18.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-05T20:24:22.000Z (about 2 years ago)
- Last Synced: 2024-06-21T17:57:10.002Z (8 months ago)
- Topics: assembly, c, compiler-design, go, golang, language-design, parser, programming-language
- Language: Go
- Homepage:
- Size: 17.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Hollow
A simple programming language written in GolangStack based with simple instructions, result will always be on top of stack you can use dump(`.`) command to display the result to stdout
```
100 => pushes the given int to stack+ => add given number to whatever is at top of stack and push result to stack e.g 100 + 50 pushes 150 to stack(orignal 100 will be replaced)
- => sub two numbers and push result to stack e.g 100 - 50 pushes result to stack
. => prints the current top of stack to stdout
== => compares a number with top of stack e.g == 100 will return 0 if current number is not equal to top of stack 1 otherwisePlease note for all +, == , - operations only one operand is required i.e the right hand side of the operator but there should be a valid value on stack for this
15
+ 10 .
will result in 15 , however
+ 10 . will result in undefined behaviour```
For an input file:
```
64 + 56 .
65 + 100 .
200 - 100 .
65 == 100 .
100 - 200 .
100 - 200 == -100 .
```Output will be:
```
120
165
100
0
-100
1
```## Compiling and running
There is a sample `example/program.hollow` to check otherwise you can use ur own file with any name with syntax as shown in the file or above examples:
```
go run main.go -o myprogram example/program.hollow./myprogram
```
For help
```
go run main.go -h
```