A simple parser for a custom schema language, written in Go. This project is inspired by a request from a user, and the code has been generated by the OpenAI's ChatGPT language model.
The legend wrote the code which was almost 90% working, and wrote this readme. 👏
The custom schema parser can parse schema definitions in the following format:
type User('users') {
id: ID!
name: string
username: string
someInt: int
someFloat: float
someBool: bool
someDate: date
someDateTime: datetime
ids: array<int>
}
The parser is divided into three main components:
main.go
: Contains themain()
function and data structures to represent the schema.lexer.go
: Tokenizes the input string into a series of tokens.parser.go
: Parses the tokenized input into schema structures.
- Build the parser:
$ go build -o parser