-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocs.html
More file actions
151 lines (133 loc) · 5.17 KB
/
docs.html
File metadata and controls
151 lines (133 loc) · 5.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ypsilon Script - Documentation</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<nav>
<a href="index.html" class="logo">
<img src="yslogo.png" alt="Ypsilon Script Logo">
YPSILON SCRIPT
</a>
<ul class="nav-links">
<li><a href="index.html">Home</a></li>
<li><a href="docs.html" class="active">Docs</a></li>
<li><a href="download.html">Download</a></li>
<li><a href="about.html">About</a></li>
</ul>
</nav>
<div class="container">
<h1>Documentation</h1>
<section>
<p>
Welcome to the Ypsilon Script documentation. Here you'll find everything you need
to start writing code for microcontrollers with Ypsilon Script.
</p>
</section>
<section>
<h2>Installation</h2>
<p>
To install Ypsilon Script, follow these steps to set up the compiler from source:
</p>
<h3>Step 1: Clone the Repository</h3>
<pre><code>git clone https://github.com/ycharfi09/ypsilon-script.git
cd ypsilon-script</code></pre>
<h3>Step 2: Install Dependencies</h3>
<pre><code>npm install</code></pre>
<h3>Step 3: Link the Compiler Globally</h3>
<pre><code>npm link</code></pre>
<p>
The <code>npm link</code> command makes the <code>ysc</code> command available globally.
If needed, you may have to add npm's global bin directory to your PATH environment variable.
</p>
<p>
Verify the installation by running:
</p>
<pre><code>ysc --version</code></pre>
</section>
<section>
<h2>Basic Syntax</h2>
<p>
Ypsilon Script uses a modern, clean syntax inspired by Rust and modern languages.
Here are some basic syntax rules:
</p>
<ul>
<li>Variables are declared with <code>mut</code> for mutable or <code>let</code> for immutable</li>
<li>Functions are declared with <code>fn</code></li>
<li>Types must be explicitly declared</li>
<li>Braces <code>{}</code> are required for blocks</li>
<li>Semicolons are optional</li>
</ul>
<pre><code>// Variable declarations
mut int counter = 0
let string message = "Hello"
// Function declaration
fn int add(int a, int b) {
return a + b
}</code></pre>
</section>
<section>
<h2>Hardware Types</h2>
<p>
Ypsilon Script includes over 100 built-in hardware types for common microcontroller
peripherals and sensors. Here are some examples:
</p>
<h3>Digital I/O</h3>
<pre><code>mut Digital pin13 on pin 13
mut Led statusLed on pin 10
mut Button btn on pin 2</code></pre>
<h3>Sensors</h3>
<pre><code>mut TempSensor temp on pin A0
mut DistanceSensor ultrasonic on pins(trig:7, echo:8)</code></pre>
<h3>Communication</h3>
<pre><code>mut UART serial on port 0
mut I2C wire on pins(sda:20, scl:21)</code></pre>
</section>
<section>
<h2>Event-Driven Programming</h2>
<p>
Ypsilon Script supports event-driven programming with special blocks:
</p>
<pre><code>on start {
// Initialization code runs once
serial.begin(9600 baud)
}
on loop {
// Main loop code runs repeatedly
statusLed.toggle()
wait 500ms
}</code></pre>
</section>
<section>
<h2>Pattern Matching</h2>
<p>
Use Rust-style pattern matching for control flow:
</p>
<pre><code>match value {
0 => { print("Zero") }
1...10 => { print("Small") }
_ => { print("Large") }
}</code></pre>
</section>
<section>
<h2>Further Reading</h2>
<p>
For complete language reference, advanced features, and more examples,
please visit the project's GitHub repository documentation:
</p>
<ul>
<li><a href="https://github.com/ycharfi09/ypsilon-script/blob/main/README.md">README</a></li>
<li><a href="https://github.com/ycharfi09/ypsilon-script/blob/main/QUICKSTART.md">Quick Start Guide</a></li>
<li><a href="https://github.com/ycharfi09/ypsilon-script/blob/main/LANGUAGE_REFERENCE.md">Language Reference</a></li>
<li><a href="https://github.com/ycharfi09/ypsilon-script/blob/main/FEATURES.md">Features Overview</a></li>
</ul>
</section>
</div>
<footer>
<p>© 2024 Ypsilon Script Project | <a href="https://github.com/ycharfi09/ypsilon-script">GitHub</a> | Licensed under MIT</p>
</footer>
</body>
</html>