https://github.com/noaa-oar-arl/Fyaml
Very lightweight native fortran yaml parser
https://github.com/noaa-oar-arl/Fyaml
fortran yaml yaml-parser
Last synced: 4 months ago
JSON representation
Very lightweight native fortran yaml parser
- Host: GitHub
- URL: https://github.com/noaa-oar-arl/Fyaml
- Owner: noaa-oar-arl
- License: gpl-3.0
- Created: 2024-11-26T04:15:54.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-06-23T14:23:39.000Z (5 months ago)
- Last Synced: 2025-06-23T15:24:29.076Z (5 months ago)
- Topics: fortran, yaml, yaml-parser
- Language: Fortran
- Homepage:
- Size: 1.54 MB
- Stars: 4
- Watchers: 3
- Forks: 4
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Fyaml - A Modern Fortran YAML Parser
A lightweight YAML parser written in modern Fortran that supports nested structures, sequences, and various data types. Designed for scientific computing applications needing configuration file support.
## Features
- Parse YAML files into native Fortran data structures
- Support for strings, integers, floats, booleans, and null values
- Handle nested mappings and sequences
- Comment parsing
- Debug logging with configurable levels
- Dot notation access for nested values
- Memory safe with pointer management
## Requirements
- Fortran 2008 compliant compiler (gfortran 8.0+ or ifort 19.0+)
- CMake 3.12+
## Installation
```bash
git clone https://github.com/yourusername/fyaml.git
cd fyaml
mkdir build && cd build
cmake ..
make
make install
```
## Usage
1) Create a YAML configuration file:
```yaml
database:
host: localhost
port: 5432
credentials:
username: admin
password: secret
```
2) Parse it in your Fortran code:
```fortran
program example
use fyaml
type(fyaml_doc) :: doc
type(yaml_value) :: val
call doc%load("config.yaml")
val = doc%root%get("database.host")
print *, "Host:", val%str_val
end program
```
## Project Structure
```
.
├── CMakeLists.txt
├── src/
│ ├── yaml_types.f90 ! Core type definitions
│ ├── yaml_parser.f90 ! YAML parsing implementation
│ └── fyaml.f90 ! High-level interface
├── tests/
│ └── test_example.yaml
└── example/
├── example.yaml
└── yaml_example.f90
```
## Testing
```bash
cd build
ctest --output-on-failure
```
## Documentation
Documentation is generated using FORD. To build:
```bash
ford .ford
```
## License
GNU General Public License v3.0
## Contributing
Contributions welcome! Please read CONTRIBUTING.md for guidelines.