Skip to content

Commit 6f9a7a5

Browse files
committed
docs: add language examples and document links to readme
1 parent 95f2e39 commit 6f9a7a5

2 files changed

Lines changed: 98 additions & 2 deletions

File tree

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 TechScript Team
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 77 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,82 @@ Start the interactive TechScript prompt to test out commands line-by-line:
5353
tech repl
5454
```
5555

56+
## Language Overview & Examples
57+
58+
TechScript (`.txs`) reads like English and supports modern features out of the box.
59+
60+
```python
61+
# Variables
62+
name = "Alice"
63+
age = 30
64+
const PI = 3.14159
65+
66+
# Output & Input
67+
say "Hello!"
68+
say f"Name: {name}, Age: {age}"
69+
answer = ask "What's your name? "
70+
71+
# Control flow
72+
if age >= 18:
73+
say "Adult"
74+
elif age >= 13:
75+
say "Teen"
76+
else:
77+
say "Child"
78+
79+
# Loops
80+
for i in 1..=10:
81+
say i
82+
83+
while age > 0:
84+
age -= 1
85+
86+
# Functions
87+
fn greet(name, greeting = "Hello"):
88+
say f"{greeting}, {name}!"
89+
90+
greet("Bob")
91+
92+
# Classes
93+
class Dog:
94+
fn init(self, name):
95+
self.name = name
96+
fn speak(self):
97+
say f"{self.name} says Woof!"
98+
99+
rex = Dog("Rex")
100+
rex.speak()
101+
102+
# Pipe operator (functional style)
103+
"hello world" |> upper |> say
104+
105+
# List methods
106+
[1, 2, 3].map((x) => x * 2).filter((x) => x > 3)
107+
108+
# Error handling
109+
try:
110+
throw "something went wrong"
111+
catch err:
112+
say err
113+
```
114+
56115
## Documentation & Learning
57116

58-
- **[Language Documentation](docs/)**: Explore the `docs/` folder for a deep dive into the language features, standard library, and architecture.
59-
- **[Examples](examples/)**: Check out the `examples/` directory for ready-to-use snippets demonstrating loops, functions, variables, and more basics to get you started quickly!
117+
- **[Language Specification](docs/TECHSCRIPT_SPEC.md)**: Complete language spec with EBNF grammar.
118+
- **[200 Keyword Reference](docs/TECHSCRIPT_REFERENCE.md)**: All keywords, functions, and methods.
119+
- **[User Guide](docs/TECHSCRIPT_GUIDE.md)**: Beginner-friendly getting started guide.
120+
- **[Example Programs](docs/TECHSCRIPT_EXAMPLES.md)**: 15 complete example programs.
121+
- **[Build Guide (Lexer/Parser)](docs/TECHSCRIPT_BUILD.md)**: How the interpreter works internally.
122+
- **[Build Guide (Interpreter)](docs/TECHSCRIPT_BUILD_2.md)**: Evaluator, CLI, REPL, and packaging details.
123+
124+
You can find ready-to-use `.txs` files in the **[examples/](examples/)** directory!
125+
126+
## License
127+
128+
TechScript is released under the MIT License. See [LICENSE](LICENSE) for details.
129+
130+
---
131+
132+
<p align="center">
133+
<strong>Made with 🐉 by the TechScript Team</strong>
134+
</p>

0 commit comments

Comments
 (0)