Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Move to Moar from Parrot; unbitrot; much improved indent handling.
First is self-explanatory, second simply due to the code being untended for a long time and easily fixed by cargo-culting a bit of code from Rakudo. Much improved indent handling has been achieved by following the Pynie approach much more closely. As a consequence, we now handle ifs with elses properly (attaching a multiply dedented else to the correct parent rather than the first available). Also adds a simple sanity test for if handling.
- Loading branch information
Showing
7 changed files
with
108 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,2 @@ | ||
| blib/*.c | ||
| blib/*.o | ||
| blib/*.pbc | ||
| blib/Snake/*.pbc | ||
| snake | ||
| blib/*.moarvm | ||
| blib/Snake/*.moarvm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,21 @@ | ||
| NQP=../nqp/nqp | ||
| PARROT=../nqp/install/bin/parrot | ||
| PBC_TO_EXE=../nqp/install/bin/pbc_to_exe | ||
| PREFIX=../nqp/install | ||
| NQP=$(PREFIX)/bin/nqp-m | ||
| MOAR=$(PREFIX)/bin/moar | ||
|
|
||
| PBCS=blib/Snake/Actions.pbc \ | ||
| blib/Snake/Compiler.pbc \ | ||
| blib/Snake/Grammar.pbc \ | ||
| MOARS=blib/Snake/Actions.moarvm \ | ||
| blib/Snake/Compiler.moarvm \ | ||
| blib/Snake/Grammar.moarvm \ | ||
| blib/snake.moarvm | ||
|
|
||
| snake: $(PBCS) src/snake.nqp | ||
| $(NQP) --target=pir src/snake.nqp | $(PARROT) -o blib/snake.pbc - | ||
| $(PBC_TO_EXE) blib/snake.pbc | ||
| cp blib/snake $@ | ||
| .PHONY: all | ||
|
|
||
| blib/%.pbc: src/%.nqp | ||
| $(NQP) --target=pir $< | $(PARROT) -o $@ - | ||
| all: $(MOARS) | ||
|
|
||
| clean: | ||
| rm -f $(PBCS) | ||
| blib/%.moarvm: src/%.nqp | ||
| $(NQP) --target=mbc --output=$@ $< | ||
|
|
||
| test: | ||
| test: all | ||
| prove -r --exec ./snake t/sanity/*.t | ||
|
|
||
| clean: | ||
| -rm $(MOARS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Caveat emptor: Extremely ad hoc, won't ever work outside of snake root | ||
| # directory. | ||
| exec ../nqp/install/bin/moar --execname="$0" --libpath=blib \ | ||
| --libpath=../nqp/install/languages/nqp/lib blib/snake.moarvm "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| if 1: | ||
| nqp::say('1..1') | ||
| if 0: | ||
| nqp::say("BAIL OUT!") | ||
| else: | ||
| nqp::print('not ') | ||
|
|
||
| nqp::say('ok 1 - else attachment') |