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/##//' 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!)