Giter VIP home page Giter VIP logo

aps_logcomp's Introduction

Lingua Nova

Motivação

O objetivo deste projeto é a criação de uma linguagem de programação simples, com sintaxe similar a linguagem Julia, porém adaptando a sintaxe para o português visando facilitar o aprendizado de programação para pessoas que não tem familiaridade com o inglês. Isso contribui para a inclusão de pessoas que não tem familiaridade com o inglês no mundo da programação e hoje não tem acesso a esse tipo de conhecimento.

EBNF

BLOCO = { COMANDO };
COMANDO = ( λ | ATRIBUICAO | IMPRIMA | ENQUANTO | SE | FUNCAO | RETORNE | CHAMEFUNCAO), "\n" ;
FUNCAO = "funcao", IDENTIFICADOR, "(" [PARAMETRO], ")", "::", TIPO, "\n", BLOCO, "fim";
PARAMETRO = IDENTIFICADOR, "::", TIPO, {",", IDENTIFICADOR, "::", TIPO};
ENQUANTO = "enquanto", "(", RELEXPR, ")", COMANDO;
SE = "se", "(", RELEXPR, ")", COMANDO, {"senao", COMANDO};
EXPRESSAO = TERMO, { ("+" | "-"), TERMO } ;
TERMO = FATOR, { ("*" | "/" | "&&" | "."), FATOR } ;
RELEXPR = EXPRESSAO, { ("<" | ">" | "==" ), EXPRESSAO } ;
RETORNE = "retorne", RELEXPR;
FATOR = (NUMERO | STRING | IDENTIFICADOR, ["(", [RELEXPR, {",", RELEXPR}] ,")"] | ("+" | "-" | "!"), FATOR) | "(", RELEXPR, ")" | ("leia", "(", ")");
IDENTIFICADOR = LETRA, { LETRA | DIGITO | "_" } ;
CHAMEFUNCAO = IDENTIFICADOR, "(", [RELEXPR, {",", RELEXPR}] ,")";
ATRIBUICAO = IDENTIFICADOR, ("::", TIPO, ["=", RELEXPR] | "=", RELEXPR );
TIPO = "Int" | "String";
IMPRIMA = "imprima", "(", RELEXPR, ")" ;
NUMERO = DIGITO, { DIGITO } ;
LETRA = ( a | ... | z | A | ... | Z ) ;
DIGITO = ( 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 ) ;

Exemplos

Declaração de funções

funcao soma(a::Int, b::Int)::Int
    retorne a + b
fim

Chamada de funções

soma(1, 2)

Declaração de variáveis

a::Int = 1
b::String = "teste"

Impressão de valores

imprima(a)

Estrutura de controle

se (a > 1)
    imprima("a maior que 1")
senao
    imprima("a menor que 1")
fim

enquanto (a < 10)
    imprima(a)
    a = a + 1
fim

Entrada de dados

leia(a)

aps_logcomp's People

Contributors

benikraco avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.