
Tokyo Night Theme (Dark & Light Modes)
- ⭐ Features
- 📸 Screenshots
- 🏗️ Technical Implementation
- ⚙️ Technologies
- 🚀 Getting Started
- 🧪 Testing
- 📜 License
- 👥 Authors
Industrial-grade Brazilian document validation:
- ✅ Dual Validation Modes
Single Mode: Real-time validation with instant feedbackBatch Mode: Process multiple documents (one per line)
- 🔍 Two-Step Validation
- Finite Automaton: Format verification via DFA (5 RG patterns • 5 CPF patterns)
- Check Digit: Mathematical validation using modulo 11
- 🎨 Modern Interface
- Responsive design with Tailwind CSS
- Smooth dark/light mode transitions
Valid RG Patterns
111111111 • 11.111.111-1 • 11111.111-1 • 11.11111-1 • 11111111-1
Valid CPF Patterns
11111111111 • 111.111.111-11 • 111111.111-11 • 111.111111-11 • 111111111-11

Finite State Machine with Transition Rules
📥 Download JFLAP Project File
📊 Complete Transition Table (Enum-based States)
| State | 0-9 | x | . | - |
|---|---|---|---|---|
| → Q0 | Q1 | ❌ | ❌ | ❌ |
| Q1 | Q2 | ❌ | ❌ | ❌ |
| Q2 | Q3 | ❌ | Q12 | ❌ |
| Q3 | Q4 | ❌ | Q22 | ❌ |
| Q4 | Q5 | ❌ | ❌ | ❌ |
| Q5 | Q6 | ❌ | Q20 | ❌ |
| Q6 | Q7 | ❌ | Q29 | ❌ |
| Q7 | Q8 | ❌ | ❌ | ❌ |
| Q8 | Q9 | Q19 | ❌ | Q21 |
| Q9 * | Q10 | ❌ | ❌ | Q30 |
| Q10 | Q11 | ❌ | ❌ | ❌ |
| Q11 * | ❌ | ❌ | ❌ | ❌ |
| Q12 | Q13 | ❌ | ❌ | ❌ |
| Q13 | Q14 | ❌ | ❌ | ❌ |
| Q14 | Q15 | ❌ | ❌ | ❌ |
| Q15 | Q16 | ❌ | Q20 | ❌ |
| Q16 | Q17 | ❌ | ❌ | ❌ |
| Q17 | Q18 | ❌ | ❌ | ❌ |
| Q18 | Q19 | Q19 | ❌ | Q21 |
| Q19 * | ❌ | ❌ | ❌ | ❌ |
| Q20 | Q16 | ❌ | ❌ | ❌ |
| Q21 | Q19 | Q19 | ❌ | ❌ |
| Q22 | Q23 | ❌ | ❌ | ❌ |
| Q23 | Q24 | ❌ | ❌ | ❌ |
| Q24 | Q25 | ❌ | ❌ | ❌ |
| Q25 | Q26 | ❌ | Q29 | ❌ |
| Q26 | Q27 | ❌ | ❌ | ❌ |
| Q27 | Q28 | ❌ | ❌ | ❌ |
| Q28 | Q10 | ❌ | ❌ | Q30 |
| Q29 | Q26 | ❌ | ❌ | ❌ |
| Q30 | Q10 | ❌ | ❌ | ❌ |
(Implemented using Java Enums and HashMaps)

Single-document Text Input Validation

Multi-document Text Input Validation
src/
├── main
│ ├── java/br/edu/fesa/validator
│ │ ├── ValidatorApplication.java # Main class
│ │ ├── controller/DocumentController.java # REST endpoints
│ │ ├── model/DocumentResultModel.java # Validation result DTO
│ │ ├── service/DocumentService.java # Business logic
│ │ └── utils
│ │ ├── AFDValidator.java # State machine implementation
│ │ └── CheckDigitValidator.java # Digit calculation
│ └── resources
│ ├── templates/index.html # Thymeleaf template
│ └── static/css/styles.css # Tailwind styles
└── test
└── java/br/edu/fesa/validator
├── service/DocumentServiceTest.java # 13 Tests
└── utils
├── AFDValidatorTest.java # 13 Tests
└── CheckDigitValidatorTest.java # 12 Tests- Backend: Spring Boot 3.4.2 + Java 17
- Frontend: Thymeleaf + Tailwind CSS
- State Machine: Enum-based DFA with HashMap transitions
- Build: Maven 3.9+
- Testing: JUnit 5 + Mockito (38 Total Tests)
- JDK 17
- Maven 3.9+
git clone git@github.com:Rutpiv/cpf-rg-validator.git
cd cpf-rg-validator
mvn clean installmvn spring-boot:runAccess: 🌐 http://localhost:8080
Comprehensive validation coverage:
mvn test- ✅ 13 Service Tests (Business logic)
- ✅ 13 Automaton Tests (State transitions)
- ✅ 12 Check Digit Tests (Mathematical validation)
Distributed under BSD 3-Clause License.
➡️ View Full License Text
Students from Engenheiro Salvador Arena College:
➡️ Complete Contributors List
Compilers Course Project • 2025 Semester