https://github.com/slimenull/nua
A simple scripting language similar to Lua. 一个类似于 Lua 的简单脚本语言.
https://github.com/slimenull/nua
recursive-descent-parser syntax-tree
Last synced: 15 days ago
JSON representation
A simple scripting language similar to Lua. 一个类似于 Lua 的简单脚本语言.
- Host: GitHub
- URL: https://github.com/slimenull/nua
- Owner: SlimeNull
- License: mit
- Created: 2024-01-25T12:22:52.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-09T16:37:29.000Z (about 1 year ago)
- Last Synced: 2025-03-26T23:42:58.379Z (about 1 month ago)
- Topics: recursive-descent-parser, syntax-tree
- Language: C#
- Homepage:
- Size: 1.2 MB
- Stars: 11
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Nua
A simple scripting language similar to Lua

## Usage
```csharp
// create a nua runtime
var runtime = new NuaRuntime();// evaluate an expression
var result = runtime.Evaluate("114000 + 514")
```## Syntaxes
```python
# some number
v1 = 114514# some boolean
v2 = true# some string
v3 = "string value"# some table (key value pairs)
v4 = {
"a": 123,
"b": 456,# when the key name is a string,
c: 789
}# some list
v5 = [
123,
true,
"string item",
{ "key1": "value1" },
[ "inner list item", "item2" ]
]if v1 > 10 {
print("value 1 is greater than 10")
}if v2 {
print("value 2 is true")
} else {
print("value 2 is false")
}if len(v4) > 3 {
print("table length is greater than 3")
} elif len(v4) > 1 {
print("table length is greater than 3")
} else {
print("table has no element")
}# print value from 1 to 10
print("list elements")
for v of 1, 10 {
print(v)
}# enumerate all key-value pairs in table
print("key-value pairs")
for key, value in v4 {
print(key)
print(value)
}
```