Skip to content

Commit 492e45d

Browse files
committed
edit readme.
1 parent 09e6ebd commit 492e45d

File tree

1 file changed

+35
-282
lines changed

1 file changed

+35
-282
lines changed

README.md

Lines changed: 35 additions & 282 deletions
Original file line numberDiff line numberDiff line change
@@ -7,304 +7,57 @@ in spanish that is very simple to use. Also is an expressions based lenguage so
77

88
It is an interpreted language fully built using Go standar libreary.
99

10-
## Syntax example
11-
12-
## Variables
13-
```go
14-
var a = 5;
15-
var b = 5;
16-
var c = a + b;
17-
18-
or
19-
20-
a := 5;
21-
b := 5;
22-
c := a + b;
23-
```
24-
25-
## Types
26-
```ts
27-
var number = 5; // Integer
28-
var float = 2.5; // float
29-
var str = "string"; // string
30-
var bool = verdadero; // boolean
31-
var list = lista[1,2,3]; // list
32-
var map = mapa{1 => "a", 2 => "b"}; // map
33-
var class = nuevo SomeClass(); //class
34-
var null = nulo; // null
35-
```
36-
37-
### Operators
38-
39-
These are operators:
40-
| Operator | Symbol |
41-
|----------------------|--------|
42-
| Plus | + |
43-
| Increment | ++ |
44-
| Add assigment | += |
45-
| Minus | - |
46-
| Decrement | -- |
47-
| Subtract assigment | -= |
48-
| Multiplication | * |
49-
| Exponential | ** |
50-
| Multiply assigment | *= |
51-
| Division | / |
52-
| Division assigment | /= |
53-
| Modulus | % |
54-
| Equal | == |
55-
| Not Equal | != |
56-
| Not | ! |
57-
| Less than | < |
58-
| Greater than | > |
59-
| Less or equal than | <= |
60-
| Greater or equal than| >= |
61-
| And | && |
62-
| Or | \|\| |
63-
64-
## Functions
65-
For declaring a function, you need to use the next syntax:
66-
```ts
67-
funcion example(<Argmuent name>, <Argmuent name>) {
68-
regresa <return value>;
69-
};
70-
```
71-
72-
simple function example:
73-
```ts
74-
funcion sum(a, b) {
75-
regresa a + b;
76-
}
77-
78-
escribir(sum(5,8)); // output: 13
79-
```
80-
81-
also there is anonymous functions:
82-
```rust
83-
sum := |a, b| => {
84-
regresa a + b;
85-
};
86-
87-
escrbir(sum(a, b));
88-
```
89-
90-
## Lists
91-
List allows you to group a list of data,
92-
lists are escential in any programming lengauge
93-
```go
94-
mi_lista := lista[2, 3, 4];
95-
mi_lista[0]; // output: 2
96-
```
97-
98-
Also list have methods:
10+
## Code Snippet
9911
```rust
100-
mi_lista:agregar(5); // add 5 to the list
101-
mi_lista:pop(); // pop the last item and return it
102-
mi_lista:popIndice(0); // remove by index and return it
103-
mi_lista:map(|x| => x += 1); // increments one all the values in the array
104-
mi_lista:porCada(|x| => escribir(x)); // prints every element in the list
105-
mi_lista:filtrar(|x| => x % 2 == 0); // filter all the elements that are divisible by two
106-
```
107-
108-
109-
## HashMaps
110-
HashMaps are datastructures that help you store data by key => value
111-
representation
112-
113-
For declaring a HashMap, you need to use the next syntax:
114-
```go
115-
example := mapa{key => value, key => value, key => value};
116-
117-
// get the value of the given key
118-
example[key];
119-
```
120-
121-
for example:
122-
```go
123-
mi_mapa := mapa{
124-
"a" => 1,
125-
"b" => 2,
126-
"c" => 3,
127-
}
128-
129-
mi_mapa["a"] // output: 1
130-
```
131-
132-
## Loops
133-
WhileLoop syntax:
134-
```ts
135-
mientras(<condition>) {
136-
// code to be execute
137-
}
138-
```
139-
140-
for example:
141-
```go
142-
i := 0;
143-
mientras(i <= 5) {
144-
escribir("hola mundo");
145-
i++;
146-
}
147-
```
148-
149-
For loop syntax:
150-
```ts
151-
por(i en <iterable>) {
152-
// code to be execute
153-
}
154-
```
155-
156-
for example:
157-
```ts
158-
por(i en rango(5)) {
159-
escribir("hola mundo");
160-
}
161-
```
162-
163-
you can also can iterate lists and strings:
164-
```ts
165-
var mi_lista = lista[2,3,4];
166-
por(i en mi_lista) {
167-
escribir(i);
168-
}
169-
170-
por(i en "Hello world") {
171-
escribir(i);
172-
}
173-
```
12+
// insertion sort implementation in aura
13+
14+
funcion insertion_sort(elements) {
15+
por(i en rango(1, largo(elements))) {
16+
anchor := elements[i];
17+
j := i - 1;
18+
mientras(j >= 0 && anchor < elements[j]) {
19+
elements[j + 1] = elements[j];
20+
j--;
21+
}
17422

175-
## Clases
176-
you can create clases with following syntax:
177-
```dart
178-
clase ClassName(<constructor params>) {
179-
method() {
180-
// method body
23+
elements[j + 1] = anchor;
18124
}
182-
}
183-
```
18425

185-
for example:
186-
```go
187-
clase Persona(name, age) {
188-
saludar() {
189-
escribirF("hi im {} and i have {} years old", name, age);
190-
}
26+
escribirF("Array ordernado {}", elements)
19127
}
19228

193-
p := nuevo Persona("eddy", 24);
194-
p.saludar(); // output: hi im eddy and i have 24 years old
195-
```
196-
197-
with all this lets look a real world example with bynary search:
198-
```go
199-
funcion binary_search(elements, val) {
200-
left := 0;
201-
rigth := largo(elements) - 1;
202-
mid := 0;
203-
204-
mientras(left <= rigth) {
205-
mid = (left + rigth) / 2;
206-
mid_number := elements[mid];
207-
208-
si (mid_number == val) {
209-
regresa mid;
210-
}
29+
funcion main() {
30+
tests := lista[
31+
lista[11,9,29,7,2,15,28],
32+
lista[3, 7, 9, 11],
33+
lista[25, 22, 21, 10],
34+
lista[29, 15, 28]
35+
];
21136

212-
si (mid_number < val) {
213-
left = mid + 1;
214-
} si_no {
215-
rigth = mid - 1;
216-
}
217-
}
218-
219-
regresa -1
37+
tests:porCada(|test| => insertion_sort(test));
22038
}
221-
222-
numbers := lista[1,4,6,9,10,12,26];
223-
index := binary_search(numbers, 4);
224-
escribir("numero encontrado en el indice ", index);
225-
// output: numero encontrado en el indice 1
22639
```
22740

22841
## <h1>Installation</h1>
229-
for using it you need to have Go install check https://golang.org/ for install Go
42+
1. ### Go to Realeses and download the version that prefer **if you are using windows you need to download the .exe file**
23043

231-
<h3>first copy the repository and change to the directory created:</h3>
44+
2. <h3>move the binary to a folder of your preference for example:</h3>
23245

233-
```shell
234-
$ git clone https://github.com/DarioRoman01/AURA.git && cd AURA
235-
```
46+
```shell
47+
mv aura /home/user/bin/aura
48+
```
23649

237-
<h3>download the dependencies:</h3>
238-
239-
```shell
240-
$ go mod download
241-
```
242-
243-
<h3>check that tests pass:</h3>
244-
245-
```shell
246-
$ go test -v ./...
247-
```
248-
249-
<h3>if you use mac or linux just run the install script.
250-
this will install aura in your system</h3>
251-
252-
```shell
253-
$ chmod a+x install.sh
254-
```
255-
```shell
256-
$ ./install.sh
257-
```
258-
<br>
50+
3. <h3>Then you have to set aura in your path:</h3>
25951

260-
<h2>if you are using windows or you want to install aura in other folder follow the next steps:</h2>
52+
* on linux:
53+
```shell
54+
export PATH=$PATH:/path/to/your/install/directory
55+
```
26156

262-
263-
<h3>compile aura:</h3>
264-
265-
```shell
266-
go build -o aura
267-
```
268-
269-
<h3>You can discover the install path by running the go list command, as in the following example</h3>
270-
271-
```shell
272-
$ go list -f '{{.Target}}'
273-
```
274-
example output: /home/user/Go/bin/aura <br>
275-
276-
<h3>you can change the install target by setting the GOBIN variable using the go env command:</h3>
277-
278-
* on linux:
279-
```shell
280-
$ go env -w GOBIN=/path/to/your/bin
281-
```
282-
* on windows:
283-
```powershell
284-
$ go env -w GOBIN=C:\path\to\your\bin
285-
```
286-
<br>
287-
288-
<h3>Add the Go install directory to your system's shell path</h3>
289-
290-
* on linux:
291-
```shell
292-
$ export PATH=$PATH:/path/to/your/install/directory
293-
```
294-
295-
* on windows:
296-
```powershell
297-
$ set PATH=%PATH%;C:\path\to\your\install\directory
298-
```
299-
300-
<br>
301-
302-
<h3>Once you've updated the shell path, run the go install command to compile and install the package.
303-
then you need to go where the package was install and rename to binary aura to aura.exe</h3>
304-
305-
```shell
306-
$ go install
307-
```
57+
* on windows:
58+
```powershell
59+
set PATH=%PATH%;C:\path\to\your\install\directory
60+
```
30861

30962
<h3>then you can create a file or play with the repl.
31063
to play with the repl just run:</h3>

0 commit comments

Comments
 (0)