
GuruDev
Temos Horror ao Óbvio
4 followers
Temos Horror ao Óbvio
4 followers
🎼 A GuruDev é uma linguagem de programação inspirada na escrita musical, projetada para integrar conhecimento humano e artificial em múltiplas línguas e formatos.

4 followers
4 followers
# GuruDev EBNF Grammar The formal grammar is the backbone of any programming language. GuruDev’s grammar is designed to balance syntactic clarity, semantic flexibility, and expansion potential. The use of roots, blocks, and execution modes (serial/parallel) allows both procedural writing and modular composition of intelligent flows. The `switch` command enables dynamic transformation of execution paradigms or target language, making the language suitable for polyglot integration and resource optimization. Here is the detailed EBNF: ``` ::= ::= "[" "]" | "switch" "[" "]" "to" "[" "]" "in" ::= "serial" | "parallel" ::= (("->" | "|") ) ::= "." "(" ")" ::= "-" "-" ::= "calculate" | "illuminate" | "meditate" | "karma" | ... ::= "Python" | "JavaScript" | "C++" | ... ``` This structure allows GuruDev to be both simple for beginners and powerful for advanced applications, encouraging creativity and integration across multiple areas of knowledge. ---
# GuruDev Technical Documentation
## Installation
GuruDev can initially be implemented in Python, leveraging its rich parsing, NLP, and polyglot integration ecosystem.
Prerequisites:
- Python 3.9+
- Libraries: ply, spacy, transformers, jinja2
Install dependencies:
```bash
pip install ply spacy transformers jinja2
```
## Project Structure
- `parser/` — Analyzes and converts GuruDev code into ASTs.
- `transpiler/` — Converts ASTs into Python, JS, etc.
- `semantic/` — Maps roots, knowledge domains, and interpretation levels.
- `commands/` — Implementation of basic commands.
- `examples/` — Example GuruDev codes for testing and reference.
- `tests/` — Unit and integration tests.
## How to Use
1. Write your GuruDev code in a `.gdev` file.
2. Run the parser to generate the AST:
```bash
python parser/main.py your_file.gdev
```
3. Use the transpiler to generate code in the desired language:
```bash
python transpiler/main.py your_file.ast Python
```
## Extensibility
To expand GuruDev:
- Add new roots and domains in `semantic/roots.py`.
- Implement new commands in `commands/`.
- Contribute via issues or pull requests on the official repository.
## Testing
- Unit tests ensure each module works as intended.
- Integration scripts test joint operation and switching between modes and languages.
---
# GuruDev Practical Examples
The best way to understand GuruDev is to see it in action. The following examples demonstrate its syntax, switching power, and polyglot integration.
## 1. Serial Execution (Python)
```
[guru dev]
[serial]
C-L-C.calculate(10) -> L-N-G.illuminate("Om Shanti")
```
Transpiles to:
```python
def calculate(n): return n
def illuminate(msg): print(msg)
calculate(10)
illuminate("Om Shanti")
```
## 2. Parallel Execution (JavaScript)
```
[guru dev]
[parallel]
C-L-C.calculate(10) | L-N-G.illuminate("Om Shanti")
switch [parallel] to [serial] in JavaScript
```
Transpiles to:
```javascript
function calculate(n) { return n; }
function illuminate(msg) { console.log(msg); }
Promise.all([calculate(10), illuminate("Om Shanti")]);
```
## 3. Dynamic Mode Switching
```
[guru dev]
[serial]
C-L-C.calculate(42)
switch [serial] to [parallel] in Python
```
Transpiles to:
```python
import asyncio
async def calculate(n): return n
async def main():
await asyncio.gather(calculate(42))
asyncio.run(main())
```
These examples showcase GuruDev’s flexibility and expressive power, suitable for educational, AI, and automation projects.
---
# GuruDev FAQ & Roadmap
## Frequently Asked Questions
What is GuruDev?
GuruDev is a language and framework for polyglot, semantic, and creative programming, based on roots, interpretative levels, and knowledge domains.
What makes GuruDev different?
It enables fluid switching between paradigms, interdisciplinary integration, and is inspired by linguistics and hermeneutics, fostering creativity and flexibility.
Who can use GuruDev?
Developers, researchers, educators, artists, innovators, and anyone interested in exploring new computational horizons.
Is GuruDev open source?
Yes! The project will be launched as open source, aiming to build a global collaborative community.
Can I contribute?
Absolutely! We welcome contributions to code, documentation, examples, ideas, suggestions, and outreach.
## Roadmap
- [ ] MVP for parser and transpiler
- [ ] Prototype polyglot runtime and semantic module
- [ ] Multilingual documentation and advanced examples
- [ ] Launch events, hackathons, and workshops
- [ ] Integration with AI, NLP, and creative applications
---
Vídeo-Manifesto da GuruDev
Código Completo do Parser da GuruDev: # parser.py - Parser GuruDev completo com PLY
import ply.yacc as yacc
from lexer import tokens
# Definição da AST
class ASTNode:
def init(self, type, children=None):
self.type = type
self.children = children or []
def repr(self):
return f"{self.type}({self.children})"
class Bloco(ASTNode):
def init(self, sobrescrita, codigo, subescritas):
super().__init__('BLOCO')
self.sobrescrita = sobrescrita
self.codigo = codigo
self.subescritas = subescritas
class Sobrescrita(ASTNode):
def init(self, comentarios):
super().__init__('SOBRESCRITA')
self.comentarios = comentarios
class Codigo(ASTNode):
def init(self, declaracoes):
super().__init__('CODIGO')
self.declaracoes = declaracoes
class Subescritas(ASTNode):
def init(self, fragmentos):
super().__init__('SUBESCRITAS')
self.fragmentos = fragmentos
class FragmentoCodigo(ASTNode):
def init(self, linguagem, conteudo):
super().__init__('FRAGMENTO')
self.linguagem = linguagem
self.conteudo = conteudo
class Declaracao(ASTNode):
def init(self, tipo, children):
super().__init__(tipo)
self.children = children
class Execucao(ASTNode):
def init(self, tipo, comandos):
super().__init__(tipo)
self.comandos = comandos
# Regras de parsing
def p_programa(p):
'programa : bloco'
p[0] = ('PROGRAMA', p[1])
def p_bloco(p):
'bloco : ABRE_BLOCO sobrescrita codigo subescritas FECHA_BLOCO'
p[0] = Bloco(p[2], p[3], p[4])
def p_sobrescrita(p):
'sobrescrita : ABRE_SOBRESC comentario+ FECHA_SOBRESC'
p[0] = Sobrescrita(p[2])
def p_comentario(p):
'comentario : COMENTARIO'
p[0] = p[1]
def p_codigo(p):
'codigo : ABRE_CODIGO declaracoes FECHA_CODIGO'
p[0] = Codigo(p[2])
def p_declaracoes(p):
'''declaracoes : declaracao
| declaracoes declaracao'''
if len(p) == 2:
p[0] = [p[1]]
else:
p[0] = p[1] + [p[2]]
def p_declaracao(p):
'''declaracao : declaracao_variavel
| declaracao_chamada
| declaracao_atribuicao
| declaracao_loop
| declaracao_execucao'''
p[0] = p[1]
def p_declaracao_variavel(p):
'declaracao_variavel : TIPO IDENTIFICADOR "=" VALOR ";"'
p[0] = Declaracao('DECLARACAO_VARIAVEL', [p[1], p[2], p[4]])
def p_declaracao_chamada(p):
'''declaracao_chamada : caso IDENTIFICADOR argumentos ";"'''
p[0] = Declaracao('CHAMADA', [p[1], p[2]] + p[3])
def p_caso(p):
'''caso : VOC
| NOM
| ACU
| DAT
| GEN
| INS
| LOC
| ABL'''
p[0] = p[1]
def p_argumentos(p):
'''argumentos : "(" ")"
| "(" lista_argumentos ")"'''
p[0] = p[2] if len(p) > 2 else []
def p_lista_argumentos(p):
'''lista_argumentos : VALOR
| lista_argumentos "," VALOR'''
if len(p) == 2:
p[0] = [p[1]]
else:
p[0] = p[1] + [p[3]]
def p_declaracao_atribuicao(p):
'''declaracao_atribuicao : caso "." IDENTIFICADOR "=" VALOR ";"'''
p[0] = Declaracao('ATRIBUICAO', [p[1], p[3], p[5]])
def p_declaracao_loop(p):
'declaracao_loop : RITORNELLO_OPEN declaracoes RITORNELLO_CLOSE condicao'
p[0] = Declaracao('LOOP', [p[2], p[4]])
def p_condicao(p):
'''condicao : DA_CAPO
| DC_AL_SIGNO'''
p[0] = p[1]
def p_declaracao_execucao(p):
'''declaracao_execucao : tipo_execucao "{" declaracoes "}"'''
p[0] = Execucao(p[1], p[3])
def p_tipo_execucao(p):
'''tipo_execucao : serie
| paralelo'''
p[0] = p[1]
def p_serie(p):
'serie : SERIE'
p[0] = 'SERIE'
def p_paralelo(p):
'paralelo : PARALELO'
p[0] = 'PARALELO'
def p_subescritas(p):
'subescritas : ABRE_SUBESCRIPTAS fragmentos FECHA_SUBESCRIPTAS'
p[0] = Subescritas(p[2])
def p_fragmentos(p):
'''fragmentos : fragmento_codigo
| fragmentos fragmento_codigo'''
if len(p) == 2:
p[0] = [p[1]]
else:
p[0] = p[1] + [p[2]]
def p_fragmento_codigo(p):
'fragmento_codigo : ABRE_FRAGMENTO LINGUAGEM corpo_codigo FECHA_FRAGMENTO'
p[0] = FragmentoCodigo(p[2], p[3])
def p_corpo_codigo(p):
'corpo_codigo : declaracoes'
p[0] = p[1]
def p_error(p):
if p:
print(f"Erro de sintaxe em '{p.value}' na linha {p.lineno}")
else:
print("Erro de sintaxe no final do arquivo")
parser = yacc.yacc()
def parse(code):
result = parser.parse(code)
print(f"AST: {result}")
return result
# Teste
if name == "__main__":
data = '''
[bloco]
[sobrescrita]
"Contexto: teste"
[/sobrescrita]
¡codigo!
NOM variavel = 10;
VOC.funcao(1, "texto");
ACU.objeto.atributo = 20;
DAT.usuario.enviar("mensagem");
||: INS.modulo.usar() :|| Da Capo
serie {
LOC.memoria.alocar(100);
ABL.database.obter("query");
}
!/codigo!
[subescritas]
¿python? def soma(a, b): return a + b ?/python?
[/subescritas]
[/bloco]
'''
parse(data)
#Parser #GuruDevLanguage