- Overview
- Features
- Installation
- External dependecies
- Usage
- File Examples
- Ç Basic Rules
- Reserved Keywords
- Group members
- References
Ç language introduces a revolutionary language that is poised to redefine programming paradigms. Inspired by the robustness of the C family, this language is designed to be both accessible and versatile. Embracing the essence of the Catalan language and culture, it represents a bold step towards linguistic diversity in the software industry.
This language is more than just a tool for coding; it's a gateway to a new era of programming excellence. With a syntax akin to pseudocode, it simplifies the coding experience for learners while offering the power and flexibility sought by seasoned developers. Whether you're a novice eager to explore the world of programming or a seasoned professional seeking innovation, our language promises to elevate your coding journey to new heights.
- Compiled language
- Simplicity: Pseudocode-like syntax for easy comprehension.
- Strong Typing: Robust error-checking and code reliability.
- Multiple types allowed:
- Integer: enter
- Float: decimal
- Boolean: siono
- Error handling: Proactive error management for smooth workflows.
- Dynamic generation: Ability to dynamically compile based on imported grammar.
The compiler relies on the following external dependency:
- Gson (v2.3.1): Is a Java library that can be used to convert Java Objects into their JSON representation and vice versa. It is used to read grammar.json.
cd ProjecteLlenguatges
private static final String FILE_PATH = "path/to/file.ç";
private static final String GRAMMAR_PATH = "path/to/grammar.json";
private static final String MIPS_FILE_PATH = "path/to/mips.asm";
Once the setup is complete, follow these steps to use our compiler:
- Execute main.java.
- Copy MIPS output file to MARS MIPS Compiler.
- Check register to get expected output values.
proces res mostraTaulaMultiplicar(enter: numero) fer:
enter: iterador = 0 ç
enter: resultat = 0 ç
mentre (iterador <= 10) fer:
resultat = numero * iterador ç
mostra(numero + " * " + iterador + " = " + resultat + "\n") ç
iterador = iterador + 1 ç
fi
fi
proces Calçot() fer:
enter: n = 5 ç
mostraTaulaMultiplicar(n) ç
fi
proces enter Fibonacci(enter: n) fer:
enter: retornValue ç
si(n < 2) fer:
retornValue = n ç
fisi
sino fer:
retornValue = Fibonacci(n - 1) + Fibonacci(n - 2) ç
fisino
retorna retornValue ç
fi
proces Calçot() fer:
enter: num = 12 ç
enter: valorFibonacci = Fibonacci(num) ç
mostra("El valor de Fibonacci de " + num + " es " + valorFibonacci) ç
fi
proces enter Factorial(enter: n) fer:
enter: retornValue = 0 ç
si(n igual 0) fer:
retornValue = 1 ç
fisi
sino fer:
enter: num = n ç
retornValue = n * Factorial(n - 1) ç
mostra("Calculant factorial de " + num + ": " + retornValue + "\n") ç
fisino
retorna retornValue ç
fi
proces Calçot() fer:
enter: num = 12 ç
enter: valorFactorial = Factorial(num) ç
mostra("\nEl factorial de " + num + " és: " + valorFactorial + "\n") ç
fi
proces enter potencia(enter: x, enter: n) fer:
enter: resultat ç
si(n igual 0) fer:
resultat = 1 ç
fisi
sino fer:
si(x igual 0) fer:
resultat = 0 ç
fisi
sino fer:
enter: base = x, exponent = n ç
resultat = x * potencia(x, n - 1) ç
mostra("Calculant potencia de " + base + " elevat a " + exponent + ": " + resultat + "\n") ç
fisino
fisino
retorna resultat ç
fi
proces Calçot () fer:
enter: a = 4 ç
enter: b = 12 ç
enter: resultatPotencia = potencia(a, b) ç
mostra("\nEl resultat de la potencia de " + a + " elevat a " + b + " és: " + resultatPotencia) ç
fi
- You can use two types of comments:
- One-line comment:
proces Calçot() fer: xiuxiueja enter: valorFactorial = 5 ç enter: a = 10 ç fi
- Multiline comment:
proces Calçot() fer: comenta enter: valorFactorial = 5 ç enter: a = 10 ç ficomenta fi
- Variables must be initialized before using them.
- In 'mostra' operations there are special rule:
- You can concatenate custom strings with "enter" varibles:
mostra("El número a és igual a " + a)
- You can not add '(' or ')' inside 'mostra':
mostra("El valor de (a) és " + a)
- You can concatenate custom strings with "enter" varibles:
- Returns are only allowed at the end of functions:
proces siono mesGran(enter: a, enter: b) fer:
siono: resultat = fals ç
si(a > b) fer:
resultat = cert ç
fisi
sino fer:
resultat = fals ç
fisino
retorna resultat ç
fi
proces Calçot() fer:
enter: a = 3 ç
enter: b = 5 ç
siono: resultat = mesGran(a, b) ç
fi
- In 'si' and 'mentre' statements all members of condition have to be the same type.
xiuxiueja
comenta
ficomenta
enter
decimal
siono
res
proces
retorna
fer
fi
fisi
fisino
ç
si
sino
mentre
per
de
fins
sumant
restant
+
-
*
/
i
o
no
>
>=
<
<=
igual
diferent
Calçot
mostra
=
:
(
)
- Words containing ç or ñ
Joaquim Angàs Jordana - joaquim.angas@students.salle.url.edu
Pol Cardenal Granell - pol.cardenal@students.salle.url.edu
Pol Guarch Bosom - pol.guarch@salle.url.edu
Oriol Rebordosa Cots - oriol.rebordosa@students.salle.url.edu
Carlos Romero Rodríguez - c.romero@students.salle.url.edu