-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: modified/add README for better segregation
- Loading branch information
1 parent
fe8cde3
commit 0a43416
Showing
11 changed files
with
292 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# ccode_runner | ||
|
||
`ccode_runner` is a component designed to run arbitrary program code on local devices. It compiles or interprets code and sends the output, making it an essential part of the cpast ecosystem. | ||
|
||
## Features | ||
|
||
- **Multi-language Support**: Supports various programming languages including Rust, Python, C, C++, Java, Ruby, and JavaScript. | ||
- **Compilation and Interpretation**: Handles both ahead-of-time compilation and just-in-time interpretation. | ||
- **Optimized Execution**: Uses precompilation and caching to optimize execution times. | ||
|
||
## Getting Started | ||
|
||
### Prerequisites | ||
|
||
Ensure you have the necessary compilers and interpreters installed for the languages you intend to use. | ||
|
||
### Installation | ||
|
||
Clone the repository and navigate to the `ccode_runner` directory: | ||
|
||
```bash | ||
git clone https://github.com/rootCircle/cpast.git | ||
cd cpast/ccode_runner | ||
``` | ||
|
||
### Usage | ||
|
||
To use `ccode_runner`, you need to integrate it within your cpast testing workflow. Below is an example of how to use it: | ||
|
||
```rust | ||
use ccode_runner::lang_runner::program_store::ProgramStore; | ||
use std::path::Path; | ||
|
||
fn main() { | ||
let correct_file = Path::new("path/to/correct_file.rs"); | ||
let test_file = Path::new("path/to/test_file.rs"); | ||
let do_force_compile = true; | ||
|
||
let program_store = ProgramStore::new(correct_file, test_file, do_force_compile).unwrap(); | ||
|
||
let stdin_content = "input data"; | ||
let (is_different, correct_output, test_output) = program_store | ||
.run_codes_and_compare_output(stdin_content) | ||
.unwrap(); | ||
|
||
println!("Outputs are different: {}", is_different); | ||
println!("Correct Output: {}", correct_output); | ||
println!("Test Output: {}", test_output); | ||
} | ||
``` | ||
|
||
### Supported Languages | ||
|
||
- **Rust**: `.rs` | ||
- **Python**: `.py` | ||
- **C**: `.c` | ||
- **C++**: `.cpp`, `.cxx`, `.c++`, `.cc`, `.C` | ||
- **Java**: `.java` | ||
- **JavaScript**: `.js` | ||
- **Ruby**: `.rb` | ||
|
||
### Compilation and Execution | ||
|
||
`ccode_runner` uses different strategies for different languages: | ||
|
||
- **Ahead-of-Time Compilation**: For languages like C, C++, Rust, and Java. | ||
- **Just-in-Time Interpretation**: For languages like Python, Ruby, and JavaScript. | ||
- **Ahead-of-Time Interpreted**: For Java, which requires converting to intermediate bytecode before execution. | ||
|
||
ccode_runner is well suited when repeated compilation might be required for one code like in case for cpast, it intelligently skips those cases for you, making it lot faster! | ||
|
||
## Contributing | ||
|
||
We welcome contributions! Please read our [Contributing Guidelines](../CONTRIBUTING.md) for more details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
pub mod program_store; | ||
mod runner; | ||
pub mod runner; | ||
pub(crate) mod runner_error_types; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,61 @@ | ||
# clex_llm | ||
|
||
Use this to generate clex from input_format and constarints. | ||
> [!NOTE] | ||
> Builds are currently broken for android mobiles, but we have no intention as of now to support it at this moment. | ||
## Run tests | ||
> [!NOTE] | ||
> See previous efforts at [cpast_llm](https://github.com/rootCircle/cpast_llm). | ||
**clex_llm** is a tool designed to generate [Clex](../clex/README.md) language expressions from input formats and constraints using a language model. It simplifies the process of creating complex test cases by converting human-readable descriptions into formal Clex grammar representations. | ||
|
||
## Features | ||
|
||
- **Automated Clex Generation**: Automatically generate Clex expressions based on input formats and constraints. | ||
- **Integration with Google Generative AI**: Utilizes Google Generative AI for generating accurate and efficient Clex expressions. | ||
|
||
## Getting Started | ||
|
||
### Prerequisites | ||
|
||
Ensure you have Rust installed on your machine. You can install Rust using [rustup](https://rustup.rs/). | ||
|
||
### Installation | ||
|
||
Clone the repository and navigate to the `clex_llm` directory: | ||
|
||
```bash | ||
git clone https://github.com/rootCircle/cpast.git | ||
cd cpast/clex_llm | ||
``` | ||
|
||
### Usage | ||
|
||
To use `clex_llm`, you need to set up your Google Generative AI API key and run the tests: | ||
|
||
```bash | ||
GEMINI_API_KEY="<api-key>" cargo test | ||
``` | ||
|
||
### | ||
|
||
Example | ||
|
||
Here’s a complete example demonstrating how to use the `clex_llm` module: | ||
|
||
```rust | ||
use clex_llm::{create_generator, generate_clex_expression}; | ||
|
||
#[tokio::main] | ||
async fn main() { | ||
let api_key = "your_google_api_key"; | ||
let generator = create_generator(api_key).unwrap(); | ||
|
||
let input_format = "The first line contains an integer K, followed by K lines each containing a floating-point number P."; | ||
let constraints = "1 ≤ K ≤ 50\n0.0 ≤ P ≤ 1000.0"; | ||
|
||
match generate_clex_expression(&generator, input_format, constraints).await { | ||
Ok(expression) => println!("Generated Clex Expression: {}", expression), | ||
Err(e) => eprintln!("Error generating Clex expression: {}", e), | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.