项目作者: dalzilio

项目描述 :
Nets is a Go library for parsing Petri nets, and Time Petri nets, written using the textual description format of the Tina toolbox
高级语言: Go
项目地址: git://github.com/dalzilio/nets.git
创建时间: 2021-05-18T07:29:56Z
项目社区:https://github.com/dalzilio/nets

开源协议:GNU Affero General Public License v3.0

下载





Logo



A Go library for parsing Petri nets

Nets

Nets is a Go library for parsing Petri nets, and Time Petri nets, written
using the textual description format of the Tina
toolbox
. The format is defined in the section on
the .net format described
in the manual pages for
Tina
.

The library provides an exported type for dealing with Petri nets that can be
useful to build new tools. We also provide methods to marshall a Net into a .net
file or a PNML file for Place/Transition nets.

Go Report Card
Go Reference
Release

Installation

  1. go get github.com/dalzilio/nets

Usage

You can find some examples of code in the *_test.go files and some example of
.net files in directory testdata. The main function, Parse, returns a
Net struct from an io.Reader.

  1. package main
  2. import (
  3. "fmt"
  4. "os"
  5. "github.com/dalzilio/nets"
  6. )
  7. func main() {
  8. file, _ := os.Open("testdata/sokoban_3.net")
  9. net, err := nets.Parse(file)
  10. if err != nil {
  11. log.Fatal("parsing error: ", err)
  12. }
  13. fmt.Printf("net %s has %d transitions\n", net.Name, len(net.Tr))
  14. // Output:
  15. // net Sokoban has 452 transitions
  16. }

Dependencies

The library has no dependencies outside of the standard Go library. It uses Go
modules and has been tested with Go 1.16.

License

This software is distributed under the GNU Affero GPL
v3
. A copy of the license
agreement is found in the LICENSE file.

Authors