Code Monkey home page Code Monkey logo

languagegym's Introduction

Diagrama

# LanguageGym

Descrição

O LanguageGym é um projeto de criação de uma linguagem para a disciplina de Logica de Programação. A ideia é criar uma linguagem que seja simples e intuitiva para que programar um treino seja mais fácil e divertido.

EBNF

PROGRAM = { EXERCISE_ROUTINE };
EXERCISE_ROUTINE = ( ASSIGNMENT | PRINT | REPEAT | IF | VARIABLE_DECLARATION | EXERCISE_INSTRUCTION), "\n" ;
ASSIGNMENT = IDENTIFIER, "=", BOOLEAN_EXPRESSION;
PRINT = "print", "(", BOOLEAN_EXPRESSION , ")" ;
READ = "read", "(", ")" ;
REPEAT="repeat","(",NUMBER,")","\n","{",{EXERCISE_ROUTINE},"}",;

IF  = "if", BOOLEAN_EXPRESSION,"\n", "{", {EXERCISE_ROUTINE},"}", ["else", "\n",   "{",{EXERCISE_ROUTINE},"}"];
VARIABLE_DECLARATION = "var", IDENTIFIER, [ "=", BOOLEAN_EXPRESSION] ;
EXERCISE_INSTRUCTION = EXERCISE_NAME ,"(" ,NUMBER, ")";
BOOLEAN_EXPRESSION = BOOLEAN_TERM, { ("or" ), BOOLEAN_TERM};
BOOLEAN_TERM = REL_EXPRESSION, { ("and" ), REL_EXPRESSION};
REL_EXPRESSION= EXPRESSION, { ("==" |">"|"<"), EXPRESSION};

EXPRESSION = TERM, { ("+" | "-"), TERM } ;
TERM = FACTOR, { ("*" | "/"), FACTOR } ;
FACTOR = (("+" | "-"|"not"), FACTOR) | NUMBER | IDENTIFIER | "(" , BOOLEAN_EXPRESSION , ")" | READ  ;
IDENTIFIER = LETTER, { LETTER | DIGIT | "_" } ;
NUMBER = DIGIT, { DIGIT } ;
LETTER = ( "a" | "..." | "z" | "A" | "..." | "Z" ) ;
DIGIT = ( "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "0" ) ; 

EXERCISE_NAME       = ("PUSH_UPS"
                      | "SQUATS"
                      | "PLANK"
                      | "CRUNCHES"
                      | "LUNGES");

Exemplos

var sets = 3;
var squats_per_set = 15;

repeat(sets) {
    squats(squats_per_set);
    plank(30);
}

if (squats_per_set > 10) {
    lunges(12);
} else {
    crunches(20);
}

Neste exemplo, definimos variáveis para o número de séries (sets) e o número de agachamentos por série (squats_per_set). Em seguida, usamos instruções de loop (repeat) e condicionais (if-else) para criar uma rotina de exercícios dinâmica.

languagegym's People

Contributors

hudsonarauj 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.