Skip to content

Commit

Permalink
Merge pull request #147 from Jens0512/master
Browse files Browse the repository at this point in the history
[vm, misc] Removed completely unnecessary and unused vm `@source`, and added `help` and `clean` makefile rules.
  • Loading branch information
faultyserver authored Feb 3, 2018
2 parents 079ff17 + 15671a3 commit 0bd6841
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
/bin/
/.shards/

# Crystal generated docs
/docs/
# The myst executable
/myst
# DWARF file from compiling on macOS
Expand Down
19 changes: 14 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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/##//'
8 changes: 3 additions & 5 deletions src/myst/vm.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down Expand Up @@ -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!)
Expand Down

0 comments on commit 0bd6841

Please sign in to comment.