Skip to content

PyForge is a custom Python compiler built using .NET and C#. It provides an interactive shell for real-time Python code execution and supports a variety of commands for enhanced user interaction. PyForge is designed to parse Python code, evaluate expressions, and provide detailed diagnostics to help debug and improve your Python scripts.

License

Notifications You must be signed in to change notification settings

redayzarra/PyForge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyForge Compiler

PyForge is a custom Python compiler built using .NET and C#. It provides an interactive shell for real-time Python code execution and supports a variety of commands for enhanced user interaction. PyForge is designed to parse Python code, evaluate expressions, and provide detailed diagnostics to help debug and improve your Python scripts.

Table of Contents

  1. Features
  2. Technology Stack
  3. Setup and Installation
  4. Using the Compiler
  5. Contributing
  6. License

Features

  • Interactive Python Shell: Directly type and execute Python expressions.
  • Parse Tree Visualization: Toggle the visibility of the syntax tree for a detailed understanding of parsing.
  • Detailed Diagnostics: Receive detailed error messages and highlights to easily locate and fix issues.
  • Command Support: Includes commands for clearing the screen, showing/hiding the parse tree, testing and exiting the compiler.
  • Variable Management: Persistent variable states across commands within a session.
  • Color-Coded Output: Utilizes different console colors to enhance readability and differentiate output types.

Technology Stack

  • Language: C#
  • Framework: .NET 7.0
  • Testing: xUnit.net test suite with MSBuild

Setup and Installation

  1. Clone the repository:

    git clone https://github.com/redayzarra/PyForge.git
  2. Navigate to the project:

    cd PyForge
  3. Build the project:

    dotnet build
  4. Configure PowerShell scripts: To make running the compiler and tests easier, you can add custom functions to your PowerShell profile:

    • Open your PowerShell profile in Notepad:

      notepad $PROFILE
    • Add the following functions to the end of the file:

      function run-compiler {
          Set-Location "C:\YOUR\PATH\TO\PyForge\main"
          clear
          .\run.bat
      }
      
      function test-compiler {
          Set-Location "C:\YOUR\PATH\TO\PyForge"
          clear
          dotnet build
          dotnet test .\Tests\Tests.csproj
      }
    • Save and close Notepad. To load these new functions, restart PowerShell, or reload your profile:

      . $PROFILE
  5. Run the PowerShell functions: Once you've set up the PowerShell functions, you can easily run your compiler or execute the tests with the following commands in PowerShell:

    • To run the compiler:

      run-compiler
    • To run the tests:

      test-compiler

Using the Compiler

  1. To start the compiler, navigate to the main project folder and run the following in the terminal:

    run-compiler
  2. This will open the interactive shell. You can start typing Python expressions immediately. Use the following commands within the shell:

  • showTree(): Show the parse tree of the entered expression.
  • hideTree(): Hide the parse tree.
  • clear(), cls: Clear the console.
  • reset(): Reset all variables and clear the console.
  • run(): Rerun the compiler without needing to exit.
  • test(): Test the compiler using custom tests.
Compiler testing output
  • exit(): Exit the compiler.

Contributing

Contributions are welcome! If you have suggestions or improvements, please fork the repository and submit a pull request. For major changes or enhancements, please open an issue first to discuss what you would like to change.

License

This project is licensed under the MIT license. Please see the LICENSE file for details.

About

PyForge is a custom Python compiler built using .NET and C#. It provides an interactive shell for real-time Python code execution and supports a variety of commands for enhanced user interaction. PyForge is designed to parse Python code, evaluate expressions, and provide detailed diagnostics to help debug and improve your Python scripts.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published