{"id":28444859,"url":"https://github.com/rutpiv/conditional-command-parser","last_synced_at":"2026-05-09T10:02:00.894Z","repository":{"id":284527107,"uuid":"955216704","full_name":"Rutpiv/Conditional-Command-Parser","owner":"Rutpiv","description":"Implementing a Lexical and Syntactic Analyzer with First/Follow in Spring Boot","archived":false,"fork":false,"pushed_at":"2025-05-31T05:09:09.000Z","size":150,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-31T16:51:22.404Z","etag":null,"topics":["grammar-checker","java","lexer-parser","maven","semantic-analysis","sintaxis-analyzer","spring-boot","university-project"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Rutpiv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-26T09:44:35.000Z","updated_at":"2025-05-31T05:09:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"e7b54873-de80-4239-b63a-82739f3c2e99","html_url":"https://github.com/Rutpiv/Conditional-Command-Parser","commit_stats":null,"previous_names":["rutpiv/first-follow-lexer"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/Rutpiv/Conditional-Command-Parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rutpiv%2FConditional-Command-Parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rutpiv%2FConditional-Command-Parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rutpiv%2FConditional-Command-Parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rutpiv%2FConditional-Command-Parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rutpiv","download_url":"https://codeload.github.com/Rutpiv/Conditional-Command-Parser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rutpiv%2FConditional-Command-Parser/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262647037,"owners_count":23342573,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["grammar-checker","java","lexer-parser","maven","semantic-analysis","sintaxis-analyzer","spring-boot","university-project"],"created_at":"2025-06-06T09:30:52.212Z","updated_at":"2026-05-09T10:02:00.556Z","avatar_url":"https://github.com/Rutpiv.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📚 ConditionalCommandParser – Conditional Command Parsing Utility\n\n![Tokyo Night Theme Preview](docs/images/theme-preview.png)\n_Tokyo Night Theme (Dark \u0026 Light Modes)_\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg alt=\"Java Version\" src=\"https://img.shields.io/badge/Java-17-orange?logo=java\u0026style=for-the-badge\" /\u003e\n  \u003cimg alt=\"Maven Version\" src=\"https://img.shields.io/badge/Maven-3.9+-blue?logo=apache-maven\u0026style=for-the-badge\" /\u003e\n  \u003cimg alt=\"Tests Passed\" src=\"https://img.shields.io/badge/Tests-47%20✓-brightgreen?style=for-the-badge\" /\u003e\n  \u003cimg alt=\"License\" src=\"https://img.shields.io/badge/License-BSD_3--Clause-blue?style=for-the-badge\" /\u003e\n\u003c/div\u003e\n\n## 🗂️ Table of Contents\n\n- [⭐ Features](#-features)\n- [📸 Screenshots](#-screenshots)\n- [🏗️ Technical Implementation](#️-technical-implementation)\n- [⚙️ Technologies](#️-technologies)\n- [🚀 Getting Started](#-getting-started)\n- [🧪 Testing](#-testing)\n- [📜 License](#-license)\n- [👥 Authors](#-authors)\n\n---\n\n## ⭐ Features\n\n**A modular conditional command parsing utility with semantic analysis:**\n\n- ✅ **Advanced Parsing Engine**\n\n  - Implements a Recursive Descent Parser to handle conditional commands, assignments, and expressions with clear grammar structure.\n\n- 🔍 **Custom Lexer \u0026 Grammar Analysis**\n\n  - Robust Lexer for tokenization and type recognition (supporting `float`, `string`, `char`, and `int`).\n  - First and Follow set calculations to support predictive parsing and error handling.\n  - **Supports comments** in the input:\n    - `// line comments`\n    - `/* block comments */`\n\n- 🧠 **Semantic Analysis**\n\n  - Enforces semantic rules such as type consistency in assignments and expressions.\n  - Symbol table management for identifier tracking and type binding.\n\n- 🎨 **Syntax Tree Visualization**\n\n  - TreePrinter utility provides a clear, labeled printout of the abstract syntax tree (AST), including node types and relationships.\n\n- 🖥️ **Modern Web Interface**\n\n  - Web controller (ParserController) and a responsive `index.html` interface styled with Tailwind CSS.\n  - Includes light/dark themes inspired by the TokyoNight palette and a toggle switch for user preference.\n\n- 🧪 **Test-Driven Development**\n\n  - Extensive unit tests for Lexer, ParserService, Semantic Analysis, and FirstFollowCalculator ensure correctness and robustness.\n\n---\n\n## 📸 Screenshots\n\n### Syntax Tree Visualization\n\n![Syntax Tree Visualization](docs/images/syntax-tree.png)\n_Visual output from TreePrinter displaying the parsed conditional command tree_\n\n---\n\n## 🏗️ Technical Implementation\n\n### Grammar Specification\n\nThe parser is built using the following context-free grammar:\n\n```bnf\nS → if ( E ) S else S | id = E\nE → E + T | E - T | T\nT → T * F | T / F | F\nF → ( E ) | id\n```\n\n**Note:** In this grammar:\n\n- `id` represents either an **identifier** (e.g., variable names) or a **literal** of supported types: `float`, `string`, `char`, or `int`\n- `if`, `else`, and operators (`+`, `-`, `*`, `/`) are terminal symbols\n\n### Project Structure \u0026 Component Roles\n\n```bash\nsrc/\n├── main\n│   ├── java/br/edu/fesa/Conditional_Command_Parser\n│   │   ├── ConditionalCommandParserApplication.java # Main Spring Boot entry point\n│   │   ├── exception\n│   │   │   ├── LexicalException.java               # Custom lexical error handling\n│   │   │   ├── SemanticException.java             # Custom semantic error handling\n│   │   │   └── SyntaxException.java               # Custom syntax error handling\n│   │   ├── controller\n│   │   │   └── ParserController.java              # REST API endpoint handler\n│   │   ├── model\n│   │   │   ├── Assignment.java                    # 'id = E' assignment nodes\n│   │   │   ├── BinOp.java                         # Binary operations (+,-,*,/)\n│   │   │   ├── CharLiteral.java                   # Char literal node\n│   │   │   ├── FloatLiteral.java                  # Float literal node\n│   │   │   ├── Identifier.java                    # ID nodes (variables/numbers)\n│   │   │   ├── IfStatement.java                   # If-else control structures\n│   │   │   ├── NumberLiteral.java                 # Numeric literal node\n│   │   │   ├── ParserResponse.java                # API response wrapper\n│   │   │   ├── StringLiteral.java                 # String literal node\n│   │   │   ├── SyntaxNode.java                    # Base AST interface\n│   │   │   └── Token.java                         # Token type/value storage\n│   │   ├── semantic\n│   │   │   ├── Symbol.java                        # Symbol representation for semantic analysis\n│   │   │   └── SymbolTable.java                   # Symbol table for variable scope management\n│   │   ├── service\n│   │   │   └── ParserService.java                 # Core parsing logic orchestration\n│   │   └── utils\n│   │       ├── FirstFollowCalculator.java         # Grammar analysis utilities\n│   │       ├── Lexer.java                         # Source code tokenization\n│   │       ├── RecursiveDescentParser.java        # Syntax tree construction\n│   │       ├── SemanticAnalyzer.java              # Semantic analysis for type checking\n│   │       └── TreePrinter.java                   # AST visualization generator\n│   └── resources\n│       ├── application.properties                 # Spring configuration\n│       ├── static\n│       │   └── styles.css                         # TokyoNight theme styling\n│       └── templates\n│           └── index.html                         # Web interface template\n└── test\n    └── java/br/edu/fesa/Conditional_Command_Parser\n        ├── ConditionalCommandParserApplicationTests.java\n        ├── service\n        │   └── ParserServiceTest.java             # Service layer tests (7 tests)\n        ├── utils\n        │   ├── FirstFollowCalculatorTest.java     # Grammar analysis tests (2 tests)\n        │   ├── LexerTest.java                     # Tokenization tests (18 tests)\n        │   ├── RecursiveDescentParserTest.java    # Recursive descent parser tests (14 tests)\n        │   └── SemanticAnalyzerTest.java          # Semantic analysis tests (6 tests)\n```\n\n---\n\n## ⚙️ Technologies\n\n- **Backend**: Spring Boot 3.4.4 + Java 17\n- **Frontend**: Thymeleaf + Tailwind CSS\n- **Parsing Techniques**: Recursive descent parsing, custom lexer/tokenization, first/follow calculations\n- **Build**: Maven 3.9+\n- **Testing**: JUnit 5 (47 Total Tests)\n\n---\n\n## 🚀 Getting Started\n\n### Prerequisites\n\n- Java Development Kit (JDK) 17\n- Maven 3.9+\n\n### Installation\n\nClone the repository and build the project:\n\n```bash\ngit clone git@github.com:Rutpiv/Conditional-Command-Parser.git\ncd Conditional-Command-Parser\nmvn clean install\n```\n\n### Running the Application\n\nStart the application:\n\n```bash\nmvn spring-boot:run\n```\n\nAccess the web interface at: 🌐 [http://localhost:8080](http://localhost:8080)\n\n---\n\n## 🧪 Testing\n\n**Comprehensive validation coverage:**\n\n```bash\nmvn test\n```\n\n- ✅ **ParserService:** 7 tests ensuring correct parsing logic\n- ✅ **FirstFollowCalculator:** 2 tests validating grammar analysis\n- ✅ **Lexer:** 18 tests verifying tokenization accuracy\n- ✅ **RecursiveDescentParser:** 14 tests for syntax tree generation\n- ✅ **SemanticAnalyzer:** 6 tests validating type checking and symbol management\n\n---\n\n## 📜 License\n\nDistributed under the **[BSD 3-Clause License](./LICENSE)**.\n\n---\n\n## 👥 Authors\n\nStudents from **Engenheiro Salvador Arena College**:\n➡️ [Complete Contributors List](./AUTHORS)\n\n---\n\n\u003cdiv align=\"center\"\u003e\n  \u003csub\u003eBuilt with ♥ by Computer Engineering students\u003c/sub\u003e\u003cbr\u003e\n  \u003csub\u003eCompilers Course Project • 2025 Semester\u003c/sub\u003e\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frutpiv%2Fconditional-command-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frutpiv%2Fconditional-command-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frutpiv%2Fconditional-command-parser/lists"}