Can Zhao, Qin Liu, Zonghua Hu, Ze Yu, Dejun Wang, Bo Meng
{"title":"K-Go: An executable formal semantics of Go language in K framework","authors":"Can Zhao, Qin Liu, Zonghua Hu, Ze Yu, Dejun Wang, Bo Meng","doi":"10.1049/blc2.12024","DOIUrl":null,"url":null,"abstract":"<p>Go is a relatively new programming language and has become one of the most important programming languages used widely in blockchain. A formal semantics plays an important role in program synthesis, analysis and verification. The existed formal semantics of Go are not executable and do not cover the core features, hence, this paper presents an executable formal semantics for Go, called K-Go, using rewriting logic in <math>\n <semantics>\n <mi>K</mi>\n <annotation>$\\mathbb{K}$</annotation>\n </semantics></math> framework to make sure the semantics is both executable and applicable. K-Go includes syntax, configuration and rules and covers the declaration and definition of basic types, basic expression, concurrency, main statement data reading and writing based on channel. K-Go is validated by test set with 100% semantic coverage based on the official test suite. The evaluation experiment shows that K-Go is correct. Using formal semantics of Go language, building Go program synthesis, analysis and verification tools is easy for analyzing more characteristics of Go programs.</p>","PeriodicalId":100650,"journal":{"name":"IET Blockchain","volume":"3 2","pages":"61-73"},"PeriodicalIF":0.0000,"publicationDate":"2023-03-13","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"https://onlinelibrary.wiley.com/doi/epdf/10.1049/blc2.12024","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"IET Blockchain","FirstCategoryId":"1085","ListUrlMain":"https://onlinelibrary.wiley.com/doi/10.1049/blc2.12024","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0
Abstract
Go is a relatively new programming language and has become one of the most important programming languages used widely in blockchain. A formal semantics plays an important role in program synthesis, analysis and verification. The existed formal semantics of Go are not executable and do not cover the core features, hence, this paper presents an executable formal semantics for Go, called K-Go, using rewriting logic in framework to make sure the semantics is both executable and applicable. K-Go includes syntax, configuration and rules and covers the declaration and definition of basic types, basic expression, concurrency, main statement data reading and writing based on channel. K-Go is validated by test set with 100% semantic coverage based on the official test suite. The evaluation experiment shows that K-Go is correct. Using formal semantics of Go language, building Go program synthesis, analysis and verification tools is easy for analyzing more characteristics of Go programs.