#  Grammar service
Grammar service is backend for managing context-free grammars and their rules.
## Source code of used libraries
[xml-srgs-parser](https://github.com/bkiefer/srgs2xml/tree/753a2cc3b563cad1ad50dd1e3aa6687ff031eb4d)

[jsgf-parser](https://github.com/cmusphinx/sphinx4)
## Installation
Download source code.
### Without docker
You need [postgres](https://www.postgresql.org/) database. And  in application.properties set postgres setting. 

Use [maven](https://maven.apache.org/) to install target
```bash
mvn install
```
Run java
```bash
java -jar ./target/grammarmanager-0.1.jar
```
### With [docker](https://www.docker.com/)
```bash
docker compose up app
```
App shoud start at [localhost:8080](https://localhost:8080) 
## Documentation
### Grammar api
api/grammars
- get
  - /all gets all grammars
  - /{id} gets grammar with specific id as path parameter
- post 
  - /- add new grammar: json body as new grammar
- delete
  - /all - deletes all grammars
  - /{id} - delete specific grammar with id as path parameter
### Rule api
api/rules
- delete
  - /all - deletes all rules
- post 
  - /{id} - adds new rule: json body as rule, query parameter grammar id, grammar id where we want to add rule
- get 
  - /all - get all rules