Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
79c0dd3
Add Regexp-Regexp Concat operator for Grammar DSL
vkutuev Feb 10, 2026
36a33ce
Add paths extraction app
vkutuev Feb 10, 2026
5ece2ae
Add more examples
vkutuev Feb 10, 2026
38dd6a0
Optimize imports in path extractor
vkutuev Feb 11, 2026
8672268
Remove unneeded class in path extractor
vkutuev Feb 11, 2026
573f321
Add sppf saving to path extractor
vkutuev Feb 11, 2026
7e7ea11
Corrected grammar. More examples.
gsvgit Feb 11, 2026
0f27589
Multiple paths from loops.
gsvgit Feb 11, 2026
38072c4
Corrected grammar. Corrected examples.
gsvgit Feb 11, 2026
0cc147c
Brief readme.
gsvgit Feb 11, 2026
dc6ab72
Small code cleanup.
gsvgit Feb 11, 2026
77f2a5e
Corrected grammar. More examples.
gsvgit Feb 11, 2026
85a5231
Multiple paths from loops.
gsvgit Feb 11, 2026
03b2582
Corrected grammar. Corrected examples.
gsvgit Feb 11, 2026
b813da6
Brief readme.
gsvgit Feb 11, 2026
19c1444
Small code cleanup.
gsvgit Feb 11, 2026
ff15198
Fix examples. Not finished.
gsvgit Feb 20, 2026
5ca7f8a
Added explicit Points-to analysis
gsvgit Feb 20, 2026
9d28557
Draft of updated readme.
gsvgit Feb 20, 2026
cb70a3c
Impreved readme: detailed description of examples
gsvgit Feb 20, 2026
cb8c88e
Missed figures
gsvgit Feb 20, 2026
5c16ff5
Merge branch 'path-extractor' into path-extractor
gsvgit Feb 20, 2026
4ddcde2
Merge pull request #2 from gsvgit/path-extractor
vkutuev Feb 20, 2026
7ddd261
Fix module and packages names
vkutuev Mar 8, 2026
1363fef
feat(simple-examples): add example_1 graph pathfinding with grammar
danisaev Mar 21, 2026
b31810b
docs(README.md): Added README.md file to simple_examples
danisaev Apr 1, 2026
ae0da12
fix(README.md): Fixed image display issue
danisaev Apr 1, 2026
e20352d
fix(README.md): Fixed bug with text display
danisaev Apr 1, 2026
7627887
docs(README.md): Added RSM of AnBn grammar
danisaev Apr 3, 2026
6a94359
docs(README.md): Correction of the wording
danisaev Apr 3, 2026
794f400
docs(README.md): Correction of wording
danisaev Apr 3, 2026
33f68d9
docs(README.md): Added explanations to the first simple example
danisaev Apr 8, 2026
89df2e7
docs(README.md): Added explanations of the second simple example
danisaev Apr 8, 2026
39c79a3
docs(README.md): fixed some comments
danisaev Apr 14, 2026
49c2c5f
docs(README.md): changing the wording
danisaev Apr 22, 2026
f8e3684
docs(README.md): Added trees extracted from SPPF for the first example
danisaev Apr 22, 2026
103d5a6
docs(README.md): added sppf split into two trees in the second example
danisaev Apr 22, 2026
9616782
docs(cfpq-paths-app/README.md): Integrating simple_examples/README.md…
danisaev Apr 22, 2026
6b5365b
docs(cfpq-paths-app/README.md): Small changes
danisaev Apr 22, 2026
cbd7706
chore: moving all the images to original folder
danisaev May 13, 2026
30f91ba
docs: Сhanging paths for images
danisaev May 13, 2026
8ce79ff
chore: changing the project structure
danisaev May 13, 2026
42de858
docs(TUTORIAL.md): Added the tutorial for using UCFS
danisaev May 14, 2026
4788d08
docs(README.md): Deleted TUTORIAL.md for README.md
danisaev May 15, 2026
a13aaec
docs: Divided the information into sections
danisaev Jun 3, 2026
9064c98
docs: Explanatory comment
danisaev Jun 3, 2026
a8e10d2
chore: Some fixes
danisaev Jul 9, 2026
00af2a1
chore: Small changes
danisaev Jul 9, 2026
2ff7bf4
docs: Added some files, modified simple_examples.md
danisaev Jul 10, 2026
b329f49
docs: Changed colors in .dot files
danisaev Jul 10, 2026
b5c9627
docs: Reorganizing dot files: vertices according to their names
danisaev Jul 10, 2026
bfe5ad6
docs: Modified README.md with Quick Start
danisaev Jul 10, 2026
04807b2
docs: Documentation restructuring
danisaev Jul 12, 2026
1770231
docs: Some changes
danisaev Jul 12, 2026
7f4ef38
docs: Added newline at the end of files
danisaev Jul 13, 2026
6bca18a
docs: New folder assets with images created
danisaev Jul 13, 2026
8c30bc4
ci: add test workflow, rename ci.yml to ci-docs.yml
griga311 Mar 22, 2026
1a94a12
ci build: restructure test infrastructure, add coverage reporting and…
griga311 Apr 3, 2026
ddc68ed
ci: restructure test workflow and configure GitHub Packages publishing
griga311 Jul 9, 2026
fc11cc5
chore: upgrade Gradle to version 9.6.1
griga311 Jul 9, 2026
500e925
chore: upgrade Java to 21 version
griga311 Jul 9, 2026
e5ae717
chore: fix kotlin plugin in cfpq-paths-app module
vkutuev Jul 14, 2026
2e7e2fb
docs: remove bad link to mathjax in config
vkutuev Jul 14, 2026
57e4360
docs: add agent-ready documentation for developers and AI agents
vkutuev Jul 14, 2026
1730a72
docs: add guide for writing user documentation
vkutuev Jul 14, 2026
705589e
docs(dev): add path representation rule to user docs guide
vkutuev Jul 14, 2026
651b943
docs: replace ASCII edge lists with TeX \xrightarrow{} notation
vkutuev Jul 14, 2026
0c0b731
docs: add documentation-first policy rule for agents
vkutuev Jul 14, 2026
ce5a4b7
fix: correct Temr typo and add explicit nav to mkdocs.yml
vkutuev Jul 14, 2026
d51741d
refactor: unify DSL repetition operators to lowercase functions
vkutuev Jul 14, 2026
13437a6
docs(agents): add documentation update rules for API refactoring
vkutuev Jul 15, 2026
a4bad74
chore(build): update JDK toolchain from 11 to 21
vkutuev Jul 15, 2026
0c2718b
docs: add agent workflow rules and conventional commit guidance
vkutuev Jul 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
26 changes: 26 additions & 0 deletions .github/workflows/ci-publishing-jar-files.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Publish package to GitHub Packages
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup JDK 21
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '21'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
- name: Run tests
run: ./gradlew test
- name: Publish package
run: ./gradlew publish --stacktrace
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35 changes: 35 additions & 0 deletions .github/workflows/ci-test-infrastructure.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Run tests and test coverage
on:
push:
pull_request:
workflow_dispatch:
permissions:
pull-requests: write
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '21'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
- name: Run tests and verify coverage
run: ./gradlew --no-daemon testCodeCoverageReport

- name: Add coverage to PR
id: jacoco
uses: madrapps/jacoco-report@v1.8.0
with:
paths: ${{ github.workspace }}/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 95
min-coverage-changed-lines: 0

- name: Verify coverage
run: ./gradlew jacocoTestCoverageVerification
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# Tests output
./test-shared/gen/

# Log file
*.log
*.logs

bin/

.gradle
!gradle/wrapper/gradle-wrapper.jar
**/build/
Expand All @@ -28,4 +33,4 @@
!/benchmarks/src/main/java/org/ucfs/scanner/*.flex

### Large datasets ###
/benchmarks/src/test/resources/java/correct/*
/benchmarks/src/test/resources/java/correct/*
148 changes: 148 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# AGENTS.md

This file helps AI agents understand and work with the UCFS codebase.

## Project Overview

**UCFS** (Universal Context-Free Solver) is a Kotlin library that performs context-free path querying on edge-labeled directed graphs using a modified GLL (Generalized LL) parsing algorithm with Recursive State Machines (RSM).

**Key capabilities:**
- Parse arbitrary directed graphs against context-free grammars
- Produce SPPF (Shared Packed Parse Forest) — compact representation of all matching paths
- Support for grammar definition via Kotlin DSL
- DOT graph format support

## Module Structure

| Module | Description |
|--------|-------------|
| `solver/` | Core library — GLL parser, RSM, grammar DSL, SPPF, input graph |
| `generator/` | Code generator built on solver — AST extraction, parser generation |
| `test-shared/` | Shared test infrastructure, dynamic tests, ANTLR4 comparison |
| `cfpq-paths-app/` | Runnable demo application with examples |

### Module Dependencies

```mermaid
graph TD
Solver[solver]
Generator[generator] --> Solver
TestShared[test-shared] --> Solver
TestShared --> Generator
App[cfpq-paths-app] --> Solver
```

## Build System

- **Tool:** Gradle with Kotlin DSL (`build.gradle.kts`)
- **Wrapper:** `./gradlew` included, no local Gradle install needed
- **JDK:** 21+ (toolchain configured in each module)
- **Kotlin:** 2.4.0

### Essential Commands

```bash
./gradlew build # Build all modules
./gradlew test # Run all tests
./gradlew testCodeCoverageReport # Generate coverage report (HTML + XML)
./gradlew jacocoTestCoverageVerification # Verify coverage thresholds
./gradlew :cfpq-paths-app:runSimpleExamples # Run demo examples
```

### Coverage Thresholds

| Counter | Minimum |
|---------|---------|
| Instruction | 95% |
| Branch | 80% |
| Line | 80% |
| Method | 85% |
| Class | 90% |

## Code Conventions

- **Style:** `kotlin.code.style=official` (set in `gradle.properties`)
- **Package root:** `org.ucfs` for all modules
- **Naming:** PascalCase for classes, camelCase for functions/properties
- **Testing:** JUnit 5 with `useJUnitPlatform()`

## Documentation Conventions

- **Structured over ASCII:** Use Mermaid diagrams (`graph TD`, `flowchart LR`) and tables instead of ASCII art or text-based schemas — they render natively on GitHub
- **Unified style:** All documentation follows a consistent structure: purpose → prerequisites → content → cross-references
- **Developer docs:** Place in `dev/` directory; user-facing docs go to `docs/docs/`

## Agent Workflow Rules

### General Workflow

1. **Plan-first policy:** Before making any changes, present a plan of what will be changed and why. Wait for user approval before executing.
2. **No commits without explicit request:** Never `git commit` or `git push` unless the user explicitly asks. Present diffs for review first.
3. **Verify before presenting:** Build and tests must pass before showing changes as ready for review.
4. **Conventional commits:** All commit messages must follow the format from [CONTRIBUTING.md](CONTRIBUTING.md):
- Format: `type(scope): short description`
- Types: `feat`, `fix`, `docs`, `style`, `refactor`, `test`, `chore`
- Example: `chore(build): update JDK toolchain from 11 to 21`

### Documentation-First Policy

> Any structural or behavioral change must be reflected in the agent documentation *before* implementation.

1. Update relevant files in `dev/` (and `AGENTS.md`) to reflect the intended change
2. **Ask the user to approve the documentation changes**
3. Only after approval, commit the documentation changes
4. Then implement the actual code changes

### Documentation update rules

When refactoring public API (e.g., renaming DSL functions), update **all** documentation:

1. **Search scope:** Always search the **entire repository**, not just `docs/docs/`. Include `README.md`, `dev/*.md`, and `docs/docs/*.md` in every grep.
2. **Verify against source:** After updating docs, cross-check each code snippet against the actual API signature in source code (e.g., confirm `asStart()` takes no arguments by reading `Grammar.kt`).
3. **Build verification:** Run `./gradlew build` after any change that touches documented API to catch stale examples that no longer compile.

## Key Source Files

| File | Purpose |
|------|---------|
| `solver/.../parser/Gll.kt` | Main GLL parser implementation |
| `solver/.../grammar/combinator/Grammar.kt` | Grammar DSL base class |
| `solver/.../rsm/RsmState.kt` | RSM state representation |
| `solver/.../gss/GraphStructuredStack.kt` | GSS data structure for GLL |
| `solver/.../sppf/SppfStorage.kt` | SPPF node management |
| `solver/.../input/InputGraph.kt` | Input graph representation |
| `generator/.../ast/AstExtractor.kt` | AST extraction from SPPF |

## Key Abstractions

- **`Grammar`** — DSL base class; users extend it to define CFGs
- **`RsmState`** — Recursive State Machine state; grammar compiles to RSM
- **`Gll`** — Parser that runs RSM against input graph
- **`IInputGraph<V, L>`** — Generic graph interface with vertices and labeled edges
- **`RangeSppfNode`** — SPPF node representing a range of matched input
- **`Descriptor<V>`** — Processing unit in GLL: (position, GSS node, RSM state, SPPF node)

## Data Flow

```mermaid
flowchart LR
Grammar[User Grammar DSL] --> RSM[RSM]
RSM --> GLL[Gll.parse]
GLL --> SPPF[SPPF]
SPPF --> Results[Path extraction / AST]
Graph[Input Graph DOT/code] --> GLL
```

## CI/CD

Three GitHub Actions workflows:
- `ci-test-infrastructure.yaml` — Tests + JaCoCo coverage on push/PR
- `ci-docs.yaml` — MkDocs site deployment
- `ci-publishing-jar-files.yaml` — Maven package publishing to GitHub Packages

## Documentation

- **User docs:** `docs/docs/` (MkDocs, deployed to GitHub Pages)
- **Developer docs:** `dev/` directory
- `dev/ARCHITECTURE.md` — Detailed architecture overview
- `dev/DEVELOPMENT.md` — Local development setup guide
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

- Developer documentation in `dev/` directory
- `AGENTS.md` for AI-assisted development
- `ARCHITECTURE.md` with module and data flow overview
- `DEVELOPMENT.md` with local setup guide
- `CONTRIBUTING.md` with contribution guidelines
- `CODE_OF_CONDUCT.md`

### Changed

- Enhanced `README.md` with badges and improved structure
62 changes: 62 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at the project
maintainers. All complaints will be reviewed and investigated promptly and
fairly.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org),
version 2.1, available at
https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.
Loading