Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip] Nova versão da geração de código #8

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
# nanilang
Repositório para o Trabalho de Implementação de Linguagens de Programação

## Not Working

- Array initialization
- Array of string
- Read
- Ternary
8 changes: 4 additions & 4 deletions examples/arr.nani
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ let i[2] = { 1, 2 }: int;
let j[2] = { false, true }: bool;

def array_with_expr_index() {
let i[3] = { 3, 4, 5 }: int;
let k: int;
var i[3] = { 3, 4, 5 }: int;
var k: int;
write i[k], i[k + 1];
return;
}

def main(): int {
let i[2] = { 3, 4 }: int;
let j[2] = { false, true }: bool;
var i[2] = { 3, 4 }: int;
var j[2] = { false, true }: bool;

write i[0], i[1];
write j[0], j[1];
Expand Down
4 changes: 4 additions & 0 deletions examples/arr2.nani
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
def main(v[]: int; a: int): int {
var x = v[a] : int;
a++;
}
4 changes: 4 additions & 0 deletions examples/aspas1aspas.nani
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
def main(): int {
var i: int;
i = "1";
}
11 changes: 11 additions & 0 deletions examples/fibonacci.nani
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def main(): int {
var a = 1, b = 1, aux, i: int;
write "fibonacci";
while (b <= 100){
write a;
aux = a;
a = b;
b = b + aux;
}
return 0;
}
2 changes: 1 addition & 1 deletion examples/for.nani
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
def main(): int {
let i: int;
var i: int;

for (i = 0; i < 10; i += 1) {
write i;
Expand Down
5 changes: 3 additions & 2 deletions examples/ifs.nani
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
def main(): int {
let x = true: bool;
var x = true: bool;

if (x == true) {
let i: int;
var i: int;
read i;
write i + 10;
} else {
Expand All @@ -11,3 +11,4 @@ def main(): int {

return 0;
}

3 changes: 3 additions & 0 deletions examples/jarroba.nani
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
def main(): int {
var j@: int;
}
12 changes: 12 additions & 0 deletions examples/ternary.nani
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
def main(): int {
var a = false: bool;

var b = (a ? 1 : 2): int;
var c: int;
c = false ? 10 : 20;

write b;
write c;

return 0;
}
2 changes: 1 addition & 1 deletion rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ use_field_init_shorthand = false
force_explicit_abi = true
condense_wildcard_suffixes = false
color = "Auto"
required_version = "0.99.6"
required_version = "1.0.0"
unstable_features = false
disable_all_formatting = false
skip_children = false
Expand Down
Loading