bencc
The compiler and linter for bencV2. Generate and check broken BENCv2 code in seconds!
Bencv2 |
Golang |
package data
ctr Person {
name string @1
age uint8 @2
} |
person := data.Person{
name: "Jeff",
age: 25,
}
b, _ := benc.Encode(&person) |
----------------------------------------------- |
---------------------------------------------------------------- |
Installation
- Go to the latest release here
- Download the executable for your operation system
- Start generating!
Usage
Arguments:
-i
: the .benc input file (required)
-l
: the language to compile into (required)
-o
: the output directory (optional, default: out)
-n
: the output file name (optional, default: out)
-f
: disables the breaking changes detector (optional)
Example
- Create a .benc file (e.g. person.benc)
- Write in the BENCv2-Lang, for example:
package person
ctr Person {
age uint8 @1
name string @2
parents Parents @3
child Child @4
}
ctr Child {
age uint8 @1
name string @2
parents Parents @3
}
ctr Parents {
mother string @1
father string @2
}
- Generate Go code, using
./PATH_TO_BENCC_EXECUTABLE -i person.benc -l go
- Find instructions of how to use the generated code in your selected language:
Languages
Currently the only supported language is go
, as we only have the go-runtime.
The go-runtime
is going to be ported to C++
, which would then support any language, that allows to interact with C++
.
Valid values for -l
are:
Breaking Changes Detector (BCD)
As its name says: It detects for breaking changes, like:
- A field still exists, but is marked as reserved
- A field was removed, but is not marked as reserved
- The type of a field changed, but its ID is still the same
Building
If you like to build bencc yourself, follow this guide:
- Install go (guide), as bencc is written in it
- Clone the repository
git clone https://github.com/bencv2/bencc bencc
- Go into the new bencc folder
cd bencc
- Build bencc using go
go build .
- A file named
bencc
or bencc.exe
is the executable
Future Plans
- Full-featured documentation
- Complete BENCv2-Lang Specification
- Complete BENCv2-Format Specification
- BCD Improvements and Updates
- Porting the
go-runtime
to C++
- A linter, a syntax-highlighter (vscode extension)
- Support for Enums
- Support for Slices and Maps
- A lot more...
Authors