Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vm, misc] Removed completely unnecessary and unused vm @source, and added help and clean makefile rules. #147

Merged
merged 2 commits into from
Feb 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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