aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorRyo Nihei <nihei.dev@gmail.com>2022-08-06 18:34:40 +0900
committerRyo Nihei <nihei.dev@gmail.com>2022-08-06 18:34:40 +0900
commit90331573a642f1e7e6f3758f1eab8628793bb8f4 (patch)
tree9af1eb108a2d9eed794fff0e6e28eff5762051e6 /README.md
parentProhibit error node having children (diff)
downloadcotia-90331573a642f1e7e6f3758f1eab8628793bb8f4.tar.gz
cotia-90331573a642f1e7e6f3758f1eab8628793bb8f4.tar.xz
Remove underscore syntax matching any symbol
Underscore syntax: For instance, a tree `(expr (id 'a') (add '+') (_))` matches both source codes `a + b * c` and `a - b / c`. This feature is helpful because it allows you to emphasize the main points of the test by ignoring nodes of no interest. However, we will remove the feature for the time being to reconsider the grammar.
Diffstat (limited to 'README.md')
-rw-r--r--README.md12
1 files changed, 5 insertions, 7 deletions
diff --git a/README.md b/README.md
index 9c8d649..af7d693 100644
--- a/README.md
+++ b/README.md
@@ -132,11 +132,11 @@ a / b * 100
---
(expr
(expr
- (expr (id))
- (div)
- (expr (id)))
- (mul)
- (expr (int)))
+ (expr (id 'a'))
+ (div '/')
+ (expr (id 'b')))
+ (mul '*')
+ (expr (int '100')))
```
The test case consists of a description, an input text, and a syntax tree you expect. Each part is separated by the delimiter `---`. The syntax tree is represented by the syntax like an [S-expression](https://en.wikipedia.org/wiki/S-expression).
@@ -150,8 +150,6 @@ Passed test.txt
When you specify a directory as the 2nd argument of `vartan test` command, it will run all test cases in the directory.
-The underscore `_` allows you to match any symbols. Thus `(expr (expr (id)) (_) (expr (id)))` matches `a + b`, `a - b`, and so on.
-
### 5. Generate a parser
Using `vartan-go` command, you can generate a source code of a parser to recognize your grammar.