Skip to content

Commit c4180c8

Browse files
committed
Update README.md
1 parent e5a130f commit c4180c8

File tree

2 files changed

+10
-19
lines changed

2 files changed

+10
-19
lines changed

README.md

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,16 @@ Static type checker with struct as environment.
7474
```go
7575
type Env struct {
7676
Foo int
77-
Bar bar
77+
Bar *Bar
7878
}
7979

8080
type Bar struct {
8181
Value int
8282
}
8383

84-
program, err := expr.Compile("Foo + Bar.Value", expr.Env(Env{}))
84+
program, err := expr.Compile("Foo + Bar.Value", expr.Env(&Env{}))
8585

86-
out, err := expr.Run(program, Env{1, Bar{2}})
86+
out, err := expr.Run(program, &Env{1, &Bar{2}})
8787
```
8888

8989
Using env's methods as functions inside expressions.
@@ -102,25 +102,16 @@ program, err := expr.Compile(`"Hello " + Title()`, expr.Env(&Env{}))
102102
out, err := expr.Run(program, &Env{"world"})
103103
```
104104

105-
Using embedded structs to construct env.
105+
## Contributing
106106

107-
```go
108-
type Env struct {
109-
Helpers
110-
Name string
111-
}
107+
**Expr** consist of a few packages for parsing source code to AST, type checking AST, compiling to bytecode and VM for running bytecode program.
112108

113-
type Helpers struct{}
109+
Also expr provides powerful tool [exp](cmd/exp) for debugging. It has interactive terminal debugger for our bytecode virtual machine.
114110

115-
func (Helpers) Title(s string) string {
116-
return strings.Title(s)
117-
}
118-
119-
120-
program, err := expr.Compile(`"Hello " + Title(Name)`, expr.Env(Env{}))
121-
122-
out, err := expr.Run(program, Env{"world"})
123-
```
111+
<p align="center">
112+
<img src="docs/images/debug.gif" alt="debugger" width="605">
113+
</p>
114+
124115

125116
## Who is using Expr?
126117

docs/images/debug.gif

3.25 MB
Loading

0 commit comments

Comments
 (0)