P4 Buddy is a Visual Studio Code extension designed to assist users in understanding and debugging P4 code. The extension provides an automatically generated system description for P4 programs and leverages OpenAI's GPT-3 to provide detailed technical answers for any P4-related questions.
Features
Automatically generates a system description for P4 programs
Utilizes OpenAI's GPT-3 to provide technical answers to P4-related questions
Updates the system description every time a P4 document is saved
Provides an interactive debugging experience with OpenAI API integration
Installation
Download the P4 Buddy VSCode extension from the Visual Studio Code Marketplace.
Install the extension.
Provide your OpenAI API key when prompted.
Usage
Open a P4 file in Visual Studio Code.
Click on the P4 Buddy icon in the activity bar or run the "Start P4 Buddy" command from the command palette.
A new panel with the system description will open next to your P4 code.
Enter any P4-related questions into the input box and click the "Debug this!" button to receive a technical answer from OpenAI's GPT-3.
Example
Let's assume you have a P4 file open in Visual Studio Code. To understand the code and get a system description:
Click on the P4 Buddy icon in the activity bar or run the "Start P4 Buddy" command from the command palette.
A new panel with the system description will open next to your P4 code, displaying the control structures and tables with their properties.
If you encounter an issue or have a question related to your P4 code, enter it into the input box and click the "Debug this!" button.
The extension will communicate with OpenAI's GPT-3 and provide a technical answer for your question.
Contributing
Feel free to submit issues, bug reports, or feature requests on the GitHub repository.