Add all the files from the interpreter repo
Signed-off-by: jmug <u.g.a.mariano@gmail.com>
This commit is contained in:
parent
230fe61b12
commit
0acd1d41e8
34 changed files with 3784 additions and 0 deletions
20
pkg/ast/identifier.go
Normal file
20
pkg/ast/identifier.go
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
package ast
|
||||
|
||||
import "code.jmug.me/jmug/interpreter-in-go/pkg/token"
|
||||
|
||||
// Identifier is treated as an expression because in certain
|
||||
// circumstances they can return values (think `let some = other` where `other`
|
||||
// is actually an expression returning a value) and this makes them easier to
|
||||
// handle (according to the author).
|
||||
type Identifier struct {
|
||||
Token token.Token
|
||||
Value string
|
||||
}
|
||||
|
||||
func (i *Identifier) expressionNode() {}
|
||||
func (i *Identifier) TokenLiteral() string {
|
||||
return i.Token.Literal
|
||||
}
|
||||
func (i *Identifier) String() string {
|
||||
return i.Value
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue