Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bbakernoaa/fyaml
Very lightweight native fortran yaml parser
https://github.com/bbakernoaa/fyaml
fortran yaml yaml-parser
Last synced: 25 days ago
JSON representation
Very lightweight native fortran yaml parser
- Host: GitHub
- URL: https://github.com/bbakernoaa/fyaml
- Owner: bbakernoaa
- License: gpl-3.0
- Created: 2024-11-26T04:15:54.000Z (27 days ago)
- Default Branch: main
- Last Pushed: 2024-11-26T15:59:04.000Z (26 days ago)
- Last Synced: 2024-11-26T16:37:42.752Z (26 days ago)
- Topics: fortran, yaml, yaml-parser
- Language: Fortran
- Homepage:
- Size: 66.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.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) :: valcall 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.