nonkey

command module
v0.0.0-...-b3b5e69 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 20, 2021 License: MIT Imports: 7 Imported by: 0

README

nonkey

customized monkey interpreter

from https://github.com/skx/monkey/

from https://interpreterbook.com/

changed

changed to typed enum by genenum (https://github.com/kasworld/genenum)

tokentype
objecttype
precedence

change builtin function init

interpreter/evaluator/builtin_init.go

change parse function init

interpreter/parser/parser.go 

prefixParseFns
infixParseFns
postfixParseFns

add repl from waig_code

add runmon for runfile, runstring with env

update nonkey, run 1 line ,run file, repl

add autoload arg

add global data package builtinfunctions, pragmas

change some map to slice for performance

interpreter/parser/parser.go

prefixParseFns
infixParseFns
postfixParseFns

enum/tokentype/attrib.go

Token2Precedences

add "I" to interface name

split asti interface package

change version handle (use https://github.com/kasworld/version)

update build script

update build version, args handle

add tokentype.attrib

change switch by operator string to tokentype

add NodeI(token.Token) to object.Error for source code line, posinline

TODO

replace ';' with '\n' or '\r'

del method call (tokentype PERIOD .) implement incomplete

If the implementation is hard to explain, it's a bad idea.

del redundant function define (tokentype DEFINE_FUNCTION function)

There should be one--and preferably only one--obvious way to do it.

del redundant ternary operator( tokentype QUESTION "? :" )

del indentifier composite char ( ? . % )

identifier start char must letter and _ , not digit, following letter,_ and digit

change "for" keyword to "while"

bug to fix

method call act oddly

Documentation

Overview

Monkey is a scripting language implemented in golang, based upon the book "Write an Interpreter in Go", written by Thorsten Ball.

This implementation adds a number of tweaks, improvements, and new features. For example we support file-based I/O, regular expressions, the ternary operator, and more.

For full details please consult the project homepage https://github.com/skx/monkey/

Directories

Path Synopsis
config
enum
interpreter
ast
Package ast contains the definitions of the abstract-syntax tree that our parse produces, and our interpreter executes.
Package ast contains the definitions of the abstract-syntax tree that our parse produces, and our interpreter executes.
evaluator
Package evaluator contains the core of our interpreter, which walks the AST produced by the parser and evaluates the user-submitted program.
Package evaluator contains the core of our interpreter, which walks the AST produced by the parser and evaluates the user-submitted program.
lexer
Package lexer contains the code to lex input-programs into a stream of tokens, such that they may be parsed.
Package lexer contains the code to lex input-programs into a stream of tokens, such that they may be parsed.
object
Package object contains our core-definitions for objects.
Package object contains our core-definitions for objects.
parser
Package parser is used to parse input-programs written in monkey and convert them to an abstract-syntax tree.
Package parser is used to parse input-programs written in monkey and convert them to an abstract-syntax tree.
token
Package token contains constants which are used when lexing a program written in the monkey language, as done by the parser.
Package token contains constants which are used when lexing a program written in the monkey language, as done by the parser.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL