https://github.com/kashicode/simplescript
Interpreter built in C
https://github.com/kashicode/simplescript
c education
Last synced: about 1 year ago
JSON representation
Interpreter built in C
- Host: GitHub
- URL: https://github.com/kashicode/simplescript
- Owner: KashiCode
- License: mit
- Created: 2023-12-04T20:07:54.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-05-24T15:25:45.000Z (about 1 year ago)
- Last Synced: 2025-05-30T02:04:32.352Z (about 1 year ago)
- Topics: c, education
- Language: C
- Homepage:
- Size: 26.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
- Lexical analysis π¦π¦π¦π¦π¦π¦π¦π¦π¦π¦ 100%
- Syntax analysis π¦π¦π¦π¦π¦π¦π¦π¦β¬οΈβ¬οΈ 80%
- Semantic analysis β¬οΈβ¬οΈβ¬οΈβ¬οΈβ¬οΈβ¬οΈβ¬οΈβ¬οΈβ¬οΈβ¬οΈ 0%
## π Language Example:
```
Value1(Int): 100
Value2(String): 'Hello'
Output{Value1}
Output{Value1,Value2}
Output{'this is a test'}
@ comment
Output{'enter your age'}
```
## π Grammar rules
```
assignment: ':'
output: "Output" '{' ( (',' )*)? '}'
comment: '@'
variable:
type: "Int" | "String"
value: |
identifier: ( | )*
number: +
string_literal: "'" "'"
string_content: *
text: *
letter: [a-zA-Z]
digit: [0-9]
character: any valid character except for single quote
```
## πLexer output
```
Token: Value1, Type: 0
Token: Int, Type: 1
Token: :, Type: 2
Token: 100, Type: 4
Token: Value2, Type: 0
Token: String, Type: 1
Token: :, Type: 2
Token: Hello, Type: 3
Token: Output, Type: 6
Token: {, Type: 7
Token: Value1, Type: 0
Token: }, Type: 8
Token: Output, Type: 6
Token: {, Type: 7
Token: Value1, Type: 0
Token: Value2, Type: 0
Token: }, Type: 8
Token: Output, Type: 6
Token: {, Type: 7
Token: this is a test, Type: 3
Token: }, Type: 8
Token: @ comment, Type: 5
Token: Output, Type: 6
Token: {, Type: 7
Token: enter your age, Type: 3
Token: }, Type: 8
```
## π Parser output
```
Assignment: Variable = Value1, Value = 100
Assignment: Variable = Value2, Value = Hello
Output: Values = Value1
Output: Values = Value1 Value2
Output: Values = this is a test
Comment: This line is a comment
Output: Values = enter your age
```