monkey_lang 0.9.7

Writing an Interpreter for the Monkey 🐒 Language in Dart #

Build Status

A fully working interpreter for the Monkey programming language as known from the book Writing an Interpreter in Go, written in Dart.

Install Monkey and start the REPL #

With one command, you can install the monkey binary:

$ pub global activate monkey_lang
Downloading monkey_lang 0.9.1...
[...]
Installed executable monkey.

Now you can run monkey from anywhere you want!

$ monkey
Hello! This is the Monkey programming language!
Feel free to type in commands
>> let answer = fn(){ 6*7; };
>> answer()
42

Run the test suite #

$ pub run test
[...]
00:00 +42: All tests passed! 

Format + analyze the code #

$ ./dartformat_analyze.sh
Formatting directory lib/:
[...]
Formatting directory test/:
[...]
Analyzing [.]...
No issues found

Go ahead and have fun with Monkey!

Use this package as an executable

1. Install it

You can install the package from the command line:


$ pub global activate monkey_lang

2. Use it

The package has the following executables:


$ monkey

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  monkey_lang: ^0.9.7

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:monkey_lang/ast/ast.dart';
import 'package:monkey_lang/evaluator/builtins.dart';
import 'package:monkey_lang/evaluator/evaluator.dart';
import 'package:monkey_lang/lexer/lexer.dart';
import 'package:monkey_lang/monkey/monkey.dart';
import 'package:monkey_lang/object/environment.dart';
import 'package:monkey_lang/object/object.dart';
import 'package:monkey_lang/parser/parser.dart';
import 'package:monkey_lang/token/token.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
18
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
58
Overall:
Weighted score of the above. [more]
50
Learn more about scoring.

We analyzed this package on Aug 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in libraries.

Health issues and suggestions

Document public APIs. (-0.10 points)

344 out of 355 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Maintenance issues and suggestions

Provide a file named CHANGELOG.md. (-20 points)

Changelog entries help developers follow the progress of your package. See the example generated by stagehand.

The package description is too short. (-12 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and monkey_lang.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.4.0 <3.0.0
Dev dependencies
pedantic ^1.0.0
test ^1.0.0