Issue #14: Grammar Generation Feature (https://github.com/blenderskool/vyaakaran/issues/14)
Pull Request: PR #25 (https://github.com/blenderskool/vyaakaran/pull/25)
Issue #4: Improved Cheat Sheet Accessibility (https://github.com/blenderskool/vyaakaran/issues/4)
Pull Request: PR #23 (https://github.com/blenderskool/vyaakaran/pull/23)
Issue #21: Enhanced Automata Processing (https://github.com/blenderskool/vyaakaran/issues/21)
Pull Request: PR #22 (https://github.com/blenderskool/vyaakaran/pull/22)
Linter Setup
Pull Request: PR #24 (https://github.com/blenderskool/vyaakaran/pull/24)
Improved Cheat Sheet Accessibility
To address issue #4 (https://github.com/blenderskool/vyaakaran/issues/4), the cheat sheet functionality has been enhanced for better accessibility:
Button Addition: A button has been added to the split pane section, displaying a component with grammar syntax information.
Draggable Component: The component is draggable and has an active background, allowing seamless access to syntax while adding grammar.
Focused Examples: The example in the cheat sheet now focuses solely on grammar rules, removing potentially distracting syntax.
These changes make it easier for users to reference grammar rules while working in the editor. PR #23 (https://github.com/blenderskool/vyaakaran/pull/23)
Enhanced Automata Processing
Addressing issues #21 (https://github.com/blenderskool/vyaakaran/issues/21) and #2 (https://github.com/blenderskool/vyaakaran/issues/2), significant improvements have been made to the efficiency of regular language processing:
NFA to DFA Conversion:
Implemented the subset construction algorithm to convert Non-deterministic Finite Automata (NFA) to Deterministic Finite Automata (DFA).
This conversion improves the processing speed and simplifies the structure of the automata.
DFA State Minimization:
Implemented Hopcroft's algorithm for reducing the number of states in a DFA.
This optimization maintains the language recognition capabilities while significantly reducing the automaton's complexity.
Optimization Algorithms:
Co-reachability: Added functionality to identify states that can reach a final state and eliminate non-contributing states, streamlining the automaton structure.
Cyclic Dependency Detection: Implemented a method to detect and raise warnings for cyclic dependencies in the automaton, helping users identify potential issues in their grammar designs.
These enhancements collectively improve the performance and reliability of automata processing within the compiler.
The integration of AI capabilities marks a significant advancement in the project's functionality:
Grammar Generation Feature
The editor now includes a powerful grammar generation feature, allowing users to create regular grammars (RG) and context-free grammars (CFG) using natural language input. This feature addresses issue #14 (https://github.com/blenderskool/vyaakaran/issues/14) and significantly improves the user experience for creating complex grammars.
Key Aspects:
CLI Command: Users can generate grammars using the generate command in the editor console.
Flexible Input: The system accepts a description of the desired grammar or language, with an optional set of example strings to enhance generation accuracy.
Multiple AI Providers: The feature supports OpenAI, Groq, and Claude (planned for future use) as AI providers for grammar generation.
Output: Generated grammars are displayed in a new playground tab corresponding to the specified grammar type.
Configuration:
API Keys: Managed through a .env file.
Provider Switching: Users can switch between AI providers by modifying the providerConfig.ts file.
Extendable System: Designed for easy integration of new AI providers.
PR #25 (https://github.com/blenderskool/vyaakaran/pull/25)
Multi-Provider Support
The system now supports multiple AI providers (OpenAI, Groq, Claude) for grammar generation. This flexibility allows users to leverage different AI models based on their preferences or availability.
Natural Language Processing
The grammar generation feature utilizes natural language processing capabilities of AI models. Users can describe grammars in plain language, making the process more intuitive and accessible to those who may not be experts in formal grammar notation.
Example-Based Enhancement
The system allows users to provide example strings, which the AI uses to refine and validate the generated grammars. This feature improves the accuracy of grammar generation, especially for complex or ambiguous language descriptions.
Linter Setup
To maintain code quality and consistency across the project:
Implemented a basic linter setup for both the compiler and editor directories.
Added new npm scripts: pnpm lint to check for errors and pnpm lint
to automatically fix issues where possible.
This setup helps in maintaining a consistent coding style and catching potential errors early in the development process. PR #24 (https://github.com/blenderskool/vyaakaran/pull/24)