From 10598da4c3d32e81d4cf320fe2d7e9f1fc6299d8 Mon Sep 17 00:00:00 2001 From: Jens Date: Sat, 3 Feb 2018 15:14:42 +0100 Subject: [PATCH 1/2] Added `docs` to gitignore, and added makefile rules `help` and `clean` --- .gitignore | 2 ++ Makefile | 19 ++++++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 61588c0..7b9ff58 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,8 @@ /bin/ /.shards/ +# Crystal generated docs +/docs/ # The myst executable /myst # DWARF file from compiling on macOS diff --git a/Makefile b/Makefile index 686fcf2..43a3b08 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,22 @@ -.PHONY: spec -spec: +.PHONY: help clean spec mystspec + +spec: ## Runs all specs crystal spec crystal run src/myst_cli.cr -- spec/myst/spec.mt -mystspec: +myst-spec: ## Runs just the in-language specs crystal run src/myst_cli.cr -- spec/myst/spec.mt -default: +build: ## Builds myst into an executable shards build -check: +check: ## Runs all crystal specs crystal spec/ + +clean: ## Cleans (deletes) docs and executables + rm -rf docs + rm bin/* + +# https://gist.github.com/prwhite/8168133 "Help target" +help: ## Show this help. + @fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' From 15671a3f56f2fe6efbf2c4f4c9af6d2232fa41d5 Mon Sep 17 00:00:00 2001 From: Jens Date: Sat, 3 Feb 2018 15:25:13 +0100 Subject: [PATCH 2/2] [vm] Removed completely unnecessary `@source` property on the vm --- src/myst/vm.cr | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/myst/vm.cr b/src/myst/vm.cr index 20830fd..75414ee 100644 --- a/src/myst/vm.cr +++ b/src/myst/vm.cr @@ -13,9 +13,7 @@ module Myst # Just telling warn() we're not in test mode (test declaration in # spec/spec_helper.cr) ENV["MYST_ENV"] = product? ? "prod" : "test" - - - @source = source + @interpreter = Interpreter.new @semantic_visitor = Semantic::Visitor.new @@ -31,7 +29,7 @@ module Myst @program = uninitialized Expressions # Parse the program into an AST # This can throw an error (ParseError) - @program = Parser.new(@source, source_name).parse + @program = Parser.new(source, source_name).parse end def self.for_file(source_file : String, *, with_stdlib? : Bool = true, use_stdios? : Bool = false, product? : Bool = true) @@ -93,7 +91,7 @@ module Myst end end - # Runs the `@source` io + # Runs the `@program` property def run # Interpret the program run(@program.not_nil!)