-
Notifications
You must be signed in to change notification settings - Fork 5
/
readme.html
141 lines (128 loc) · 7.47 KB
/
readme.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Readme</title>
<link rel="stylesheet" href="css/common.css">
</head>
<body>
<h1 class="center">Speech Programmer</h1>
<div class='container'>
<h2 class='purple'>About</h2>
<div>
<p>The speech programmer is a web tool aimed at writing code based on voice commands. As of now, the tool only writes C code, and its usage is dependent upon various conditions that must be met when giving voice commands. Read this documentation to understand the proper usage of this tool for the best results.</p>
</div>
<h2 class='purple'>Usage</h2>
<h3><u>Libraries</u></h3>
<div>
<ul>
<li>To include a library, start the command with the word <i>include</i>.</li>
<li>Follow the <i>include</i> word by the name of the library to be included.</li>
<li>Do <b>not</b> use the <i>.h</i> in your command; this is included automatically when the include statement is written.</li>
<li>Do not use the word <i>hash</i> or similar in your command. This is also added automatically.</li>
<li>Include statements are always added at the top of the file.</li>
</ul>
</div>
<h3><u>Data Types</u></h3>
<div>
<p>To use data types throughout the tool, use the following conventions:</p>
<ul>
<li>To use the <tt>int</tt> data type, use the word <i>integer</i>.</li>
<li>To use the <tt>char</tt> data type, use the word <i>character</i>.</li>
<li>To use the <tt>double</tt> or <tt>float</tt> data types, use the corresponding word itself.</li>
</ul>
</div>
<h3><u>Functions</u></h3>
<div>
<ul>
<li>To define a new function, start the command with the word <i>function</i>.</li>
<li>The word <i>function</i> must be immediately succeeded by the return type of the function.</li>
<li>Follow the return type with the name of the function. The name of a function can be as long as required, and will automatically be converted to camel case.</li>
<li>To pass parameters to the function, use the word <i>takes</i> after the name of the function. This word must then be succeeded by the return type of each parameter and the parameter name.</li>
</ul>
<div class="example">
<p>Example:</p>
<p><b>Voice command: </b>function integer calculate average takes integer 'size'</p>
<p><b>Function Written: </b><tt>int calculateAverage(int size) {}</tt></p>
</div>
</div>
<h3><u>Variables</u></h3>
<div>
<ul>
<li>To declare a variable, start the voice command with the data type of the variable. (Remember to use the above given conventions for data types)</li>
<li>Follow the data type with the name of the variable. The name of the variable can be as long as required, and will automatically be converted to camel case.</li>
<li>However, you may only declare <u>one</u> variable per line.</li>
<li>To initialize a variable while declaring it, follow the name of the variable with the word <i>equals</i>, then give it the initial value.</li>
<li>Characters will automatically be initialized within single quotes.</li>
</ul>
<div class="example">
<p>Example-1:</p>
<p><b>Voice command: </b>integer size equals 5</p>
<p><b>Statement Written: </b><tt>int size = 5;</tt></p>
</div>
<div class="example">
<p>Example-2</p>
<p><b>Voice command: </b>character test equals p</p>
<p><b>Statement Written: </b><tt>char test = 'p';</tt></p>
</div>
</div>
<h3><u>Printf</u></h3>
<div>
<ul>
<li>To use the printf function, start the command with the word <i>print</i>.</li>
<li>Follow the word with the quote to print.</li>
<li>To use a variable in the quote, use the word <i>percent</i>/<i>percentage</i> in the quote. No need to use the identifier, such as 'd'; identifiers will be added automatically based on the variable's data type.</li>
<li>To specify the variable to be used instead of the placeholder, use the word <i>variable</i>.</li>
<li>Following the word <i>variable</i>, say the name of the variable to be used.</li>
<li>To add a newline(\n)in the print quote, use the word <i>line</i>.</li>
</ul>
</div>
<div class="example">
<p>Example:</p>
<p><b>Voice command: </b>print the value of test is percent line variable test</p>
<p><b>Statement written: </b><tt>printf("the value of test is %d\n ", test);</tt></p>
</div>
<h3><u>Scanf</u></h3>
<div>
<ul>
<li>To use the scanf function, start the command with the word <i>scan</i>.</li>
<li>Follow the word with the names of variables to be scanned. Format identifiers or a quote for scanf is not required. The quote will be written automatically based on the data types of variables.</li>
<li>The word <i>ampersand</i>/<i>and</i> is not required before each variable either. The '&' symbol is added automatically before each variable.</li>
</ul>
</div>
<div class="example">
<p>Example:</p>
<p><b>Voice command: </b>scanf test, size</p>
<p><b>Statement Written: </b><tt>scanf("%f%d", &test, &size);</tt></p>
</div>
<h3><u>If-Else</u></h3>
<div>
<ul>
<li>To use the if-else construct, start the command with the word <i>if</i> or <i>else</i>.</li>
<li>Follow the word with the condition. Preceed variable names with the word <i>variable</i>, and say constants (integers or chars) directly</li>
<li>To add relational operators, use the words <i>equals</i>, <i>greater</i>, <i>greater equals</i>, <i>less</i> or <i>less equals</i>.</li>
</ul>
</div>
<div class="example">
<p>Example:</p>
<p><b>Voice command: </b>if variable test greater equals 5</p>
<p><b>Statement Written: </b><tt>if (test >= 5) {}</tt></p>
</div>
<h3><u>If-Else</u></h3>
<div>
<ul>
<li>To use the while loop construct, start the command with the word <i>while</i>.</li>
<li>Follow the word with the condition. Preceed variable names with the word <i>variable</i>, and say constants (integers or chars) directly</li>
<li>To add relational operators, use the words <i>equals</i>, <i>greater</i>, <i>greater equals</i>, <i>less</i> or <i>less equals</i>.</li>
</ul>
</div>
<div class="example">
<p>Example:</p>
<p><b>Voice command: </b>while variable test greater equals 5</p>
<p><b>Statement Written: </b><tt>while (test >= 5) {}</tt></p>
</div>
<h3></h3>
</div>
</body>
</html>