Kannav02 / DialectMorph

MIT License
1 stars 2 forks source link

DialectMorph

Demo Gif

DialectMorph is a powerful code transpilation tool designed to convert source code from one programming language to another. It leverages the Groq API to perform intelligent code translations while maintaining the original functionality and logic.

Features

Installation

  1. Clone the repository:

    git clone https://github.com/Kannav02/DialectMorph.git
    cd DialectMorph
  2. Install dependencies:

    To install bun, please follow this installation guide.

    bun install

    To skip steps 3 and 4 , you can run the following script, which will run all of these commands in a single-go

    bun run linkage:build
    
  3. Run the following commands to have bun build/transpile typescript files to javascript so as to run the binary

    bun run build
  4. Link and Install Bun Binaries in the Global Scope

    we would have to register the CLI tool globally and then also install the binaries in the global scope to make it useful in the terminal

    to register the CLI tool globally ,run the following command

    bun link

    after this, to install the bun binaries globally, run the following commmand

    bun link dialect-morph
  5. Run the following commands in the terminal to make sure that .bun/bin exists in the path variable

    export PATH="/Users/username/.bun/bin:$PATH"

    reload the shell config file

    source ~/.zshrc
  6. Set up your Groq API key:

    • Create a .env file in the root directory or run the following command in the shell

      cp .env.example .env
      
    • Add your Groq API key: GROQ_API_KEY=your_api_key_here

Usage

Run DialectMorph using the following command:

Main Command

dialectMorph <input_files...> -l <output_language>

The input_files argument can take multiple files at once and is a required argument the output_language argument is also a required argument

Examples:

Take one of the files from the examples folder and run the following command

dialectMorph ./examples/example.py -l java
dialectMorph ./examples/example.cpp -l python

Optional Arguments

Supported Languages

Project Structure

Contributing

Before making any Pull Requests or Pushes to the main branch, make sure to run the following linting scripts to pass the tests set by the CI pipeline

bun run format
bun run format:check

format script here is used to format all of the files to the standards specified by prettier format:check script here is used to check if all of the files have been formatted by prettier

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License.

Acknowledgements