Permalink
Browse files

split joxa-compiler into several different namespaces

This uses the somewhat new support for mutually recursive namespaces
to split the massive joxa-compiler into a bunch of related
namespaces. It will take sometime to get these optimially organized
but at the very least this makes the compiler itself significantly
more approachable.

Signed-off-by: Jordan Wilberding <diginux@gmail.com>
  • Loading branch information...
1 parent e87c0ef commit 1f3c185e05054564530253d15805252fb7812626 @ericbmerritt ericbmerritt committed with jwilberding Oct 10, 2012
Showing with 84,316 additions and 78,459 deletions.
  1. +0 −3 Makefile
  2. +46 −0 build-support/bootstrap.mkf
  3. +29 −29 build-support/core-build.mkf
  4. +3,476 −0 src/ast/joxa-cmp-binary.ast
  5. +4,421 −0 src/ast/joxa-cmp-call.ast
  6. +7,516 −0 src/ast/joxa-cmp-case.ast
  7. +932 −0 src/ast/joxa-cmp-checks.ast
  8. +13,638 −0 src/ast/joxa-cmp-ctx.ast
  9. +2,157 −0 src/ast/joxa-cmp-defs.ast
  10. +2,490 −0 src/ast/joxa-cmp-error-format.ast
  11. +8,276 −0 src/ast/joxa-cmp-expr.ast
  12. +2,519 −0 src/ast/joxa-cmp-joxa-info.ast
  13. +8,349 −0 src/ast/joxa-cmp-lexer.ast
  14. +951 −0 src/ast/joxa-cmp-literal.ast
  15. +4,520 −0 src/ast/joxa-cmp-ns.ast
  16. +2,916 −0 src/ast/joxa-cmp-parser.ast
  17. +1,177 −0 src/ast/joxa-cmp-path.ast
  18. +3,591 −0 src/ast/joxa-cmp-peg.ast
  19. +4,435 −0 src/ast/joxa-cmp-spec.ast
  20. +1,005 −0 src/ast/joxa-cmp-special-forms.ast
  21. +827 −0 src/ast/joxa-cmp-util.ast
  22. +5,731 −73,299 src/ast/joxa-compiler.ast
  23. +169 −0 src/joxa-cmp-binary.jxa
  24. +234 −0 src/joxa-cmp-call.jxa
  25. +386 −0 src/joxa-cmp-case.jxa
  26. +45 −0 src/joxa-cmp-checks.jxa
  27. +885 −0 src/joxa-cmp-ctx.jxa
  28. +112 −0 src/joxa-cmp-defs.jxa
  29. +115 −0 src/joxa-cmp-error-format.jxa
  30. +434 −0 src/joxa-cmp-expr.jxa
  31. +209 −0 src/joxa-cmp-joxa-info.jxa
  32. +374 −0 src/joxa-cmp-lexer.jxa
  33. +55 −0 src/joxa-cmp-literal.jxa
  34. +332 −0 src/joxa-cmp-ns.jxa
  35. +189 −0 src/joxa-cmp-parser.jxa
  36. +158 −0 src/joxa-cmp-path.jxa
  37. +243 −0 src/joxa-cmp-peg.jxa
  38. +238 −0 src/joxa-cmp-spec.jxa
  39. +50 −0 src/joxa-cmp-special-forms.jxa
  40. +65 −0 src/joxa-cmp-util.jxa
  41. +106 −4,228 src/joxa-compiler.jxa
  42. +3 −3 src/joxa-core.jxa
  43. +5 −4 src/joxa-shell.jxa
  44. +8 −3 src/jxa_bootstrap.erl
  45. +1 −1 test/jxat_anon_fun.erl
  46. +11 −11 test/jxat_assert.erl
  47. +2 −3 test/jxat_bare_module.erl
  48. +1 −1 test/jxat_binary.erl
  49. +1 −1 test/jxat_case.erl
  50. +1 −1 test/jxat_core_add.erl
  51. +28 −28 test/jxat_ctx.erl
  52. +1 −3 test/jxat_do_test.erl
  53. +9 −14 test/jxat_eunit.erl
  54. +2 −2 test/jxat_examples.erl
  55. +8 −8 test/jxat_featureful_module.erl
  56. +1 −2 test/jxat_hello_world.erl
  57. +1 −1 test/jxat_implicit_do.erl
  58. +2 −4 test/jxat_incremental_compile.erl
  59. +1 −2 test/jxat_jxa_parser_proper.erl
  60. +1 −1 test/jxat_let_support.erl
  61. +724 −0 test/jxat_lexer.erl
  62. +2 −2 test/jxat_macros.erl
  63. +1 −2 test/jxat_module_fun_line_support.erl
  64. +1 −3 test/jxat_nested_calls.erl
  65. +10 −10 test/jxat_parse.erl
  66. +10 −10 test/jxat_path.erl
  67. +67 −765 test/jxat_peg.erl
  68. +1 −2 test/jxat_predicates.erl
  69. +1 −1 test/jxat_receive.erl
  70. +2 −2 test/jxat_records.erl
  71. +2 −3 test/jxat_rest_args.erl
  72. +3 −3 test/jxat_segfault_tests.erl
  73. +1 −1 test/jxat_specs.erl
  74. +1 −1 test/jxat_throws.erl
  75. +1 −1 test/jxat_try.erl
  76. +1 −1 test/jxat_variable_fun_tests.erl
View
@@ -18,9 +18,6 @@ BEAMDIR=$(APPDIR)/ebin
# Bootstrap Directories In Build
JOXA_BOOTSTRAP_DIR=$(abspath .bootstrap)
-BOOTSTRAP_LIBDIR=$(JOXA_BOOTSTRAP_DIR)
-BOOTSTRAP_APPDIR=$(BOOTSTRAP_LIBDIR)/joxa-$(VSN)
-BOOTSTRAP_BEAMDIR=$(BOOTSTRAP_APPDIR)/ebin
# Location of the support makefiles
BUILD_SUPPORT=$(CURDIR)/build-support
@@ -0,0 +1,46 @@
+## -*- mode: Makefile; fill-column: 75; comment-column: 50; -*-
+SRCDIR=$(CURDIR)/src
+BEAMDIR=$(CURDIR)/ebin
+DEPS_DIR=$(CURDIR)/deps
+ERL=$(shell which erl)
+EBIN_DIRS=$(wildcard $(DEPS_DIR)/*/ebin)
+BASE_ERLCFLAGS=$(EBIN_DIRS:%= -pa %)
+ERLCFLAGS=$(BASE_ERLCFLAGS) -pa $(BEAMDIR)
+ERLFLAGS=-noshell $(ERLCFLAGS)
+
+
+ASTDIR=$(SRCDIR)/ast
+COMP= $(ERL) $(ERLFLAGS) $(TEST_FLAGS) -s 'joxa-compiler' main \
+ -extra
+
+ASTS=$(ASTDIR)/joxa-cmp-util.ast \
+ $(ASTDIR)/joxa-cmp-path.ast \
+ $(ASTDIR)/joxa-cmp-ctx.ast \
+ $(ASTDIR)/joxa-cmp-peg.ast \
+ $(ASTDIR)/joxa-cmp-lexer.ast \
+ $(ASTDIR)/joxa-cmp-ns.ast \
+ $(ASTDIR)/joxa-cmp-call.ast \
+ $(ASTDIR)/joxa-cmp-literal.ast \
+ $(ASTDIR)/joxa-cmp-binary.ast \
+ $(ASTDIR)/joxa-cmp-special-forms.ast \
+ $(ASTDIR)/joxa-cmp-case.ast \
+ $(ASTDIR)/joxa-cmp-spec.ast \
+ $(ASTDIR)/joxa-cmp-expr.ast \
+ $(ASTDIR)/joxa-cmp-defs.ast \
+ $(ASTDIR)/joxa-cmp-joxa-info.ast \
+ $(ASTDIR)/joxa-cmp-checks.ast \
+ $(ASTDIR)/joxa-cmp-error-format.ast \
+ $(ASTDIR)/joxa-cmp-parser.ast \
+ $(ASTDIR)/joxa-compiler.ast
+
+.PHONY: all
+
+.PRECIOUS: %/.d
+
+all: $(ASTS)
+
+$(ASTDIR)/%.ast: $(SRCDIR)/%.jxa $(BEAMDIR)/jxa_bootstrap.beam
+ $(ERL) $(ERLFLAGS) -s joxa-compiler main \
+ -extra --bootstrap --to_ast -o $(ASTDIR) $<
+ echo "." >> $@
+ $(ERL) $(ERLFLAGS) -s jxa_bootstrap do_bootstrap $(BEAMDIR) $@ -s init stop
@@ -1,8 +1,4 @@
## -*- mode: Makefile; fill-column: 75; comment-column: 50; -*-
-
-LOCAL_DEPS=$(TMPDIR)/deps.tar.gz
-GOT_DEPS=$(TMPDIR)/got-em
-
TEST_EBIN=$(APPDIR)/.eunit
TEST_FLAGS=-pa $(TEST_EBIN)
@@ -12,14 +8,33 @@ EBIN_DIRS=$(wildcard $(DEPS_DIR)/*/ebin)
BASE_ERLCFLAGS=$(EBIN_DIRS:%= -pa %)
ERLCFLAGS=$(BASE_ERLCFLAGS) -pa $(BEAMDIR)
ERLFLAGS=-noshell $(ERLCFLAGS)
-
ASTDIR=$(SRCDIR)/ast
-BOOTSTRAP_ERLFLAGS=-noshell -pa $(BOOTSTRAP_BEAMDIR) $(BASE_ERLCFLAGS)
+
+BOOTSTRAP_ERLFLAGS=-noshell -pa $(BEAMDIR) $(BASE_ERLCFLAGS)
COMP= $(ERL) $(ERLFLAGS) $(TEST_FLAGS) -s 'joxa-compiler' main \
-extra
-SRCBEAMS=$(BEAMDIR)/joxa-compiler.beam \
+
+SRCBEAMS = $(BEAMDIR)/joxa-cmp-util.beam \
+ $(BEAMDIR)/joxa-cmp-path.beam \
+ $(BEAMDIR)/joxa-cmp-ctx.beam \
+ $(BEAMDIR)/joxa-cmp-peg.beam \
+ $(BEAMDIR)/joxa-cmp-lexer.beam \
+ $(BEAMDIR)/joxa-cmp-ns.beam \
+ $(BEAMDIR)/joxa-cmp-call.beam \
+ $(BEAMDIR)/joxa-cmp-literal.beam \
+ $(BEAMDIR)/joxa-cmp-binary.beam \
+ $(BEAMDIR)/joxa-cmp-special-forms.beam \
+ $(BEAMDIR)/joxa-cmp-case.beam \
+ $(BEAMDIR)/joxa-cmp-spec.beam \
+ $(BEAMDIR)/joxa-cmp-expr.beam \
+ $(BEAMDIR)/joxa-cmp-defs.beam \
+ $(BEAMDIR)/joxa-cmp-joxa-info.beam \
+ $(BEAMDIR)/joxa-cmp-checks.beam \
+ $(BEAMDIR)/joxa-cmp-error-format.beam \
+ $(BEAMDIR)/joxa-cmp-parser.beam \
+ $(BEAMDIR)/joxa-compiler.beam \
$(BEAMDIR)/joxa-core.beam \
$(BEAMDIR)/joxa-shell.beam \
$(BEAMDIR)/joxa-records.beam \
@@ -41,7 +56,7 @@ TESTBEAMS = $(TEST_EBIN)/joxa-test-let-match.beam \
$(TEST_EBIN)/joxa-test-namespace-mutual-recursion.beam \
$(TEST_EBIN)/joxa-test-joxification.beam
-.PHONY: all test_bootstrap pre_bootstrap bootstrap clean \
+.PHONY: all ootstrap clean \
jxa test build get-deps proper eunit \
cucumber shell bare-escript
@@ -56,16 +71,9 @@ all: build
@mkdir -p $(@D)
@touch $@
-$(BOOTSTRAP_BEAMDIR)/%.beam: $(SRCDIR)/%.erl $(BOOTSTRAP_BEAMDIR)/.d
- $(ERLC) $(ERLCFLAGS) -o $(BOOTSTRAP_BEAMDIR) $<
-
-$(BOOTSTRAP_BEAMDIR)/%.beam: $(ASTDIR)/%.ast $(BOOTSTRAP_BEAMDIR)/jxa_bootstrap.beam $(BOOTSTRAP_BEAMDIR)/.d
- $(ERL) $(BOOTSTRAP_ERLFLAGS) -s jxa_bootstrap do_bootstrap $@ $< -s init stop
-
-$(BEAMDIR)/joxa-compiler.beam: $(SRCDIR)/joxa-compiler.jxa $(BOOTSTRAP_BEAMDIR)/joxa-compiler.beam
- @echo bootstrapping the compiler
- $(ERL) $(BOOTSTRAP_ERLFLAGS) -s joxa-compiler main \
- -extra --bootstrap -o $(BEAMDIR) $(SRCDIR)/joxa-compiler.jxa
+$(BEAMDIR)/%.beam: $(ASTDIR)/%.ast $(BEAMDIR)/jxa_bootstrap.beam $(BEAMDIR)/.d
+ $(ERL) $(BOOTSTRAP_ERLFLAGS) \
+ -s jxa_bootstrap do_bootstrap $(BEAMDIR) $< -s init stop
$(BEAMDIR)/%.beam: $(SRCDIR)/%.jxa $(BEAMDIR)/.d $(BEAMDIR)/joxa-compiler.beam
$(COMP) -o $(BEAMDIR) $<
@@ -116,14 +124,6 @@ bare-escript:
escript: build bare-escript
-pre_bootstrap:
-## Use the working compiler to build itself
- $(ERL) $(ERLFLAGS) -s joxa-compiler main \
- -extra --bootstrap -o $(BEAMDIR) $(SRCDIR)/joxa-compiler.jxa
-## Have the working compiler output its own core erlang ast
- $(ERL) $(ERLFLAGS) -s joxa-compiler main \
- -extra --bootstrap --to_ast -o $(ASTDIR) $(SRCDIR)/joxa-compiler.jxa
-## copy that ast into an erl file for useful later building
- echo "." >> $(ASTDIR)/joxa-compiler.ast
-
-bootstrap: pre_bootstrap clean build test
+bootstrap:
+ make -f $(CURDIR)/build-support/bootstrap.mkf
+ make
Oops, something went wrong.

0 comments on commit 1f3c185

Please sign in to comment.