-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from fabaindaiz/dev
Dev: new compiler
- Loading branch information
Showing
34 changed files
with
1,670 additions
and
1,221 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,37 +1,37 @@ | ||
*.annot | ||
*.cmo | ||
*.cma | ||
*.cmi | ||
*.a | ||
*.o | ||
*.cmx | ||
*.cmxs | ||
*.cmxa | ||
*.plist | ||
|
||
# ocamlbuild working directory | ||
_build/ | ||
|
||
# ocamlbuild targets | ||
*.byte | ||
*.native | ||
|
||
# oasis generated files | ||
setup.data | ||
setup.log | ||
|
||
# Merlin configuring file for Vim and Emacs | ||
.merlin | ||
|
||
# Dune generated files | ||
*.install | ||
|
||
# Local OPAM switch | ||
_opam/ | ||
|
||
# Build results | ||
*.s | ||
*.run | ||
|
||
# Segmentation fault | ||
*.annot | ||
*.cmo | ||
*.cma | ||
*.cmi | ||
*.a | ||
*.o | ||
*.cmx | ||
*.cmxs | ||
*.cmxa | ||
*.plist | ||
|
||
# ocamlbuild working directory | ||
_build/ | ||
|
||
# ocamlbuild targets | ||
*.byte | ||
*.native | ||
|
||
# oasis generated files | ||
setup.data | ||
setup.log | ||
|
||
# Merlin configuring file for Vim and Emacs | ||
.merlin | ||
|
||
# Dune generated files | ||
*.install | ||
|
||
# Local OPAM switch | ||
_opam/ | ||
|
||
# Build results | ||
*.s | ||
*.run | ||
|
||
# Segmentation fault | ||
core |
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,5 @@ | ||
{ | ||
"ocaml.sandbox": { | ||
"kind": "global" | ||
} | ||
} |
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,51 +1,51 @@ | ||
# Picked from https://stackoverflow.com/questions/714100/os-detecting-makefile | ||
UNAME_S := $(shell uname -s) | ||
ifeq ($(UNAME_S),Linux) | ||
BIN_FORMAT = elf64 | ||
CFLAGS ?= -z notext -g | ||
endif | ||
ifeq ($(UNAME_S),Darwin) # for mac | ||
BIN_FORMAT = macho64 | ||
CFLAGS ?= -Wl,-no_pie | ||
endif | ||
|
||
F = # nothing by default | ||
src = # nothing by default | ||
|
||
.PHONY: test | ||
|
||
init: | ||
dune build @check | ||
|
||
test: | ||
dune exec execs/run_test.exe -- test '$(F)' | ||
|
||
ctest: | ||
dune exec execs/run_test.exe -- test '$(F)' -c | ||
|
||
compile: | ||
dune exec execs/run_compile.exe $(src) | ||
|
||
compile-run: $(subst .src,.run,$(src)) | ||
./$< | ||
|
||
interp: | ||
dune exec execs/run_interp.exe $(src) | ||
|
||
%.run: %.o rt/sys.c | ||
clang -o $@ $(CFLAGS) rt/sys.c $< | ||
|
||
%.o: %.s | ||
nasm -f $(BIN_FORMAT) -o $@ $< | ||
|
||
%.s: %.src | ||
dune exec execs/run_compile.exe $< > $@ | ||
|
||
%.exe: | ||
dune build execs/$@ | ||
|
||
clean: clean-tests | ||
rm -Rf _build | ||
|
||
clean-tests: | ||
find bbctests/ -type f -regex '.*\.\(o\|s\|run\|result\)' -delete | ||
# Picked from https://stackoverflow.com/questions/714100/os-detecting-makefile | ||
UNAME_S := $(shell uname -s) | ||
ifeq ($(UNAME_S),Linux) | ||
BIN_FORMAT = elf64 | ||
CFLAGS ?= -z notext -g | ||
endif | ||
ifeq ($(UNAME_S),Darwin) # for mac | ||
BIN_FORMAT = macho64 | ||
CFLAGS ?= -Wl,-no_pie | ||
endif | ||
|
||
F = # nothing by default | ||
src = # nothing by default | ||
|
||
.PHONY: test | ||
|
||
init: | ||
dune build @check | ||
|
||
test: | ||
dune exec execs/run_test.exe -- test '$(F)' | ||
|
||
ctest: | ||
dune exec execs/run_test.exe -- test '$(F)' -c | ||
|
||
compile: | ||
dune exec execs/run_compile.exe $(src) | ||
|
||
compile-run: $(subst .src,.run,$(src)) | ||
./$< | ||
|
||
interp: | ||
dune exec execs/run_interp.exe $(src) | ||
|
||
%.run: %.o rt/sys.c | ||
clang -o $@ $(CFLAGS) rt/sys.c $< | ||
|
||
%.o: %.s | ||
nasm -f $(BIN_FORMAT) -o $@ $< | ||
|
||
%.s: %.src | ||
dune exec execs/run_compile.exe $< > $@ | ||
|
||
%.exe: | ||
dune build execs/$@ | ||
|
||
clean: clean-test | ||
rm -Rf _build | ||
|
||
clean-test: | ||
find bbctests/ -type f -regex '.*\.\(o\|s\|run\|result\)' -delete |
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,37 @@ | ||
# corewars-compiler | ||
This software aims to be an easier way to write and optimize code for corewars. corewars-compiler uses its own mini functional language which can then be compiled into optimized redcode. | ||
|
||
work in progress | ||
|
||
### references | ||
|
||
#### compiler | ||
- [BBCStepTester](https://github.com/fabaindaiz/BBCStepTester) | ||
|
||
#### standard | ||
- [beginners' guide](https://vyznev.net/corewar/guide.html) | ||
- [1994 Core War Standard](https://corewar.co.uk/standards/icws94.txt) | ||
- [REDCODE REFERENCE](https://corewa.rs/reference/pmars-redcode-94.txt) | ||
|
||
#### wariors | ||
- [warriors sorted by type](http://moscova.inria.fr/~doligez/corewar/by-types/idx.htm) | ||
- [warriors sorted by name](http://moscova.inria.fr/~doligez/corewar/by-name/complete.htm) | ||
|
||
#### validation | ||
- [ICWS94 validate](http://www.koth.org/planar/post/Validate1.1R.txt) | ||
# corewars-compiler | ||
This software aims to be an easier way to write and optimize code for corewars. corewars-compiler uses its own mini functional language which can then be compiled into optimized redcode. | ||
|
||
work in progress | ||
|
||
### Requirements | ||
- [BBCStepTester](https://github.com/fabaindaiz/BBCStepTester) | ||
|
||
### Intepreters | ||
- [A.R.E.S.](https://corewar.co.uk/ares.htm) | ||
- [PyMARS](https://github.com/rodrigosetti/corewar) | ||
|
||
|
||
## References | ||
|
||
#### Getting started | ||
- [basic manual (spanish)](https://fdist.ucm.es/corewar/CoreWar.pdf) | ||
- [the beginners' guide](https://vyznev.net/corewar/guide.html) | ||
- [my first corewars book](https://www.corewars.org/docs/book1.html) | ||
|
||
#### Redcode learning | ||
- [corewars warrior hints](https://es.scribd.com/document/231018699/Core-War-Hints) | ||
- [corewars tips & tricks](https://www.corewars.org/docs/tips.html) | ||
|
||
#### Redcode wariors | ||
- [redcode warriors](https://github.com/n1LS/redcode-warriors) | ||
- [warriors sorted by type](http://moscova.inria.fr/~doligez/corewar/by-types/idx.htm) | ||
- [warriors sorted by name](http://moscova.inria.fr/~doligez/corewar/by-name/complete.htm) | ||
|
||
#### Redcode reference | ||
- [1994 Core War Standard](https://corewar.co.uk/standards/icws94.txt) | ||
- [REDCODE REFERENCE](https://corewa.rs/reference/pmars-redcode-94.txt) | ||
- [ICWS94 validate](http://www.koth.org/planar/post/Validate1.1R.txt) | ||
|
||
#### Coreward koth | ||
- [KotH](http://www.koth.org/koth.html) | ||
- [hills](https://corewar.co.uk/hills.htm) |
Oops, something went wrong.