Skip to content

C-programGenerator: Generates C program files from natural language instructions. Features NLP, pre-built library of code snippets, and advanced text processing techniques. Accepts command-line arguments. Licensed under MIT.

Notifications You must be signed in to change notification settings

hardikpatil24/C-programGenerator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

C Program Generator

C Program Generator is a program written in C that can generate C code based on user input. It uses natural language processing (NLP) techniques to analyze user input and generate code snippets based on a library of existing code.

Getting Started

To use the C Program Generator, follow these steps:

  1. Clone the repository to your local machine.
  2. Install any necessary dependencies.
  3. Run the program using ./program_generator <input_text> where input_text is the text you want to generate code for.
  4. The generated code will be saved in a file named <generation no.>.c in the generated_code directory.

Features

  • Natural language processing (NLP) for text analysis.
  • Library of pre-written C code snippets.
  • Ability to generate code based on user input.
  • User-friendly command line interface.

Examples

Here are some examples of text inputs and the corresponding code generated by the C Program Generator:

Example 1

Input Text: Create a C program to find the factorial of a given number.

Generated Code: "#include <stdio.h>

int main() { int n, i; unsigned long long factorial = 1;

printf("Enter an integer: "); scanf("%d", &n);

// error if the user enters a negative integer if (n < 0) printf("Error: Factorial of a negative number doesn't exist."); else { for (i = 1; i <= n; ++i) { factorial *= i; } printf("Factorial of %d = %llu", n, factorial); }

return 0; }"

Example 2

Input Text: Create a C program to reverse a string.

Generated Code: "#include <stdio.h> #include <string.h>

int main() { char str[100], temp; int i, j = 0;

printf("Enter a string: "); fgets(str, sizeof(str), stdin);

i = 0; j = strlen(str) - 1;

while (i < j) { temp = str[i]; str[i] = str[j]; str[j] = temp; i++; j--; }

printf("Reversed string is: %s", str);

return 0; }"

Contributing

If you would like to contribute to the C Program Generator, please feel free to submit a pull request with your changes. We welcome contributions of all types, from bug fixes to new features and enhancements.

License

The C Program Generator is open source software released under the MIT license. See LICENSE for more information.

About

C-programGenerator: Generates C program files from natural language instructions. Features NLP, pre-built library of code snippets, and advanced text processing techniques. Accepts command-line arguments. Licensed under MIT.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages