https://github.com/freddiehaddad/corrosion
Compiler and Interpreter for the Corrosion programming language
https://github.com/freddiehaddad/corrosion
Last synced: 8 months ago
JSON representation
Compiler and Interpreter for the Corrosion programming language
- Host: GitHub
- URL: https://github.com/freddiehaddad/corrosion
- Owner: freddiehaddad
- License: mit
- Created: 2023-10-18T21:51:41.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-12-22T22:43:38.000Z (almost 2 years ago)
- Last Synced: 2025-01-29T02:16:41.120Z (9 months ago)
- Language: Go
- Size: 74.2 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Corrosion
A compiler and interpreter project written in Go and inspired by the books
[Writing A Compiler In Go] and [Writing An Interpreter In Go] by Thorsten Ball.## Language Style
Corrosion inherits a few language syntax styles. Some examples:
```C
// Syntax examples
var foo = 100;
func add(left, right) { return left + right; }
add(foo, foo); // 200func conditional(check) {
if (!check == true) {
return true;
} else {
return false;
}
}conditional(); // false
func foo() {
func bar() { return 2; }
return bar;
}foo()(); // 2
```## Obtaining Source
```bash
git clone https://github.com/freddiehaddad/corrosion
```## Building
```bash
go build -o bin ./...
```## Testing
```bash
go test -v ./...
```## Running
After building the code, the REPL can be launched with:
```bash
./bin/corrosion
```## Dependencies
Go (see [go.mod] for minimum version) is required for building. In general, any
recent version should work.## Project Layout
```text
.
├── bin
│ └── corrosion
├── cmd
│ └── corrosion
│ └── corrosion.go
├── go.mod
├── LICENSE
├── pkg
│ ├── ast
│ │ └── ast.go
│ ├── evaluator
│ │ ├── evaluator.go
│ │ └── evaluator_test.go
│ ├── lexer
│ │ ├── lexer.go
│ │ └── lexer_test.go
│ ├── object
│ │ └── object.go
│ ├── parser
│ │ ├── parser.go
│ │ └── parser_test.go
│ └── token
│ └── token.go
└── README.md
```## License
Licensed under the [MIT] license.
[go.mod]: go.mod
[mit]: LICENSE
[writing a compiler in go]: https://compilerbook.com/
[writing an interpreter in go]: https://interpreterbook.com/