Skip to content

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

Notifications You must be signed in to change notification settings

carlosromerorodriguez/C_Catalan_Language

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ç Language

Ç language logo

Table of Contents

Overview

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

Features

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

External dependencies

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.

Installation and setup

1. Download our project

2. Configure the JDK we've used (JDK-21)

3. Navigate to directory:

cd ProjecteLlenguatges

4. Select Ç input file path in main.java:

private static final String FILE_PATH = "path/to/file.ç";

5. Select Grammar JSON path:

private static final String GRAMMAR_PATH = "path/to/grammar.json";

6. Select MIPS output path:

private static final String MIPS_FILE_PATH = "path/to/mips.asm";

Usage

Once the setup is complete, follow these steps to use our compiler:

  1. Execute main.java.
  2. Copy MIPS output file to MARS MIPS Compiler.
  3. Check register to get expected output values.

File Examples

Multiplication table

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

Recursive Fibonacci

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

Recursive Factorial

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

Recursive Power

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

Ç Basic Rules

  • 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)
  • 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.

Reserved Keywords:

Comments

  • xiuxiueja
  • comenta
  • ficomenta

Vartypes

  • enter
  • decimal
  • siono
  • res

Functions

  • proces
  • retorna

Inicializers and terminators

  • fer
  • fi
  • fisi
  • fisino
  • ç

Conditional

  • si
  • sino

Iterator

  • mentre
  • per
  • de
  • fins
  • sumant
  • restant

Matematical operators

  • +
  • -
  • *
  • /

Boolean operators

  • i
  • o
  • no
  • >
  • >=
  • <
  • <=
  • igual
  • diferent

Misc

  • Calçot
  • mostra
  • =
  • :
  • (
  • )
  • Words containing ç or ñ

Group members

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

References

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5