Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/razshare/olang-old
Experimental frontend for WASI and other targets (mainly PHP).
https://github.com/razshare/olang-old
ast frontend parser php webassembly
Last synced: about 1 month ago
JSON representation
Experimental frontend for WASI and other targets (mainly PHP).
- Host: GitHub
- URL: https://github.com/razshare/olang-old
- Owner: razshare
- License: mit
- Created: 2022-11-23T21:33:52.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-03T18:01:17.000Z (almost 2 years ago)
- Last Synced: 2024-05-28T13:28:29.404Z (7 months ago)
- Topics: ast, frontend, parser, php, webassembly
- Language: PHP
- Homepage:
- Size: 86.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
Syntax showcase
```olang
// this is a struct
struct user {
username: string = "test"
email: string = "asd"
phone: string = "awerqw"
// this is a struct callable (function), it returns bool
is_admin => bool {
// logic goes here
}
}// this is a callable, it takes 2 strings and returns a bool
validate => bool {
email: string = "[email protected]"
phone: string = "111111"// validation logic
}// calling a callable, parameters must always be named
validate(email: "[email protected]", phone: "22222")// this is an if expression
if 1 > 2 {
// some comment
return 1
}// if else expression
if 2 > 1 {
// then
} else {
// else
}// and nested
if 2 > 1 {
// then
} else {
// else
if 3 === 3 {
}
}if 2 > 1 {
// then
} else if 3 === 3 {
// else if
}// due to how the parser works, this is also allowed
if 2 > 1 {
// then
} else => if 3 === 3 {
// else if
}// a few more interesting examples
if 1 > 2 => validate(email: "[email protected]", phone: "33333333")
else if 1 > 2 => false// this looks weird, don't think many would use it, but it's allowed
if 1 > 2 => validate(email: "[email protected]", phone: "44444444")
else => if 1 > 2 => false
```