aboutsummaryrefslogtreecommitdiff
path: root/spec/description.go
diff options
context:
space:
mode:
authorRyo Nihei <nihei.dev@gmail.com>2021-08-29 23:40:10 +0900
committerRyo Nihei <nihei.dev@gmail.com>2021-08-29 23:40:10 +0900
commitbb85dcc57cc3c0fff6cc9dc09540d58fef400d6f (patch)
tree2fc6a20d0c644a79d454a48c49baa26423fbd10d /spec/description.go
parentAdd describe command to print a description file (diff)
downloadurubu-bb85dcc57cc3c0fff6cc9dc09540d58fef400d6f.tar.gz
urubu-bb85dcc57cc3c0fff6cc9dc09540d58fef400d6f.tar.xz
Add precedences and associativities to the description file
Diffstat (limited to 'spec/description.go')
-rw-r--r--spec/description.go20
1 files changed, 12 insertions, 8 deletions
diff --git a/spec/description.go b/spec/description.go
index d2b6d3b..08b037e 100644
--- a/spec/description.go
+++ b/spec/description.go
@@ -1,11 +1,13 @@
package spec
type Terminal struct {
- Number int `json:"number"`
- Name string `json:"name"`
- Anonymous bool `json:"anonymous"`
- Alias string `json:"alias"`
- Pattern string `json:"pattern"`
+ Number int `json:"number"`
+ Name string `json:"name"`
+ Anonymous bool `json:"anonymous"`
+ Alias string `json:"alias"`
+ Pattern string `json:"pattern"`
+ Precedence int `json:"prec"`
+ Associativity string `json:"assoc"`
}
type NonTerminal struct {
@@ -14,9 +16,11 @@ type NonTerminal struct {
}
type Production struct {
- Number int `json:"number"`
- LHS int `json:"lhs"`
- RHS []int `json:"rhs"`
+ Number int `json:"number"`
+ LHS int `json:"lhs"`
+ RHS []int `json:"rhs"`
+ Precedence int `json:"prec"`
+ Associativity string `json:"assoc"`
}
type Item struct {