Merge pull request #1 from google/reorg_everything

Reorganize the source tree.
diff --git a/examples/span_se_log_file_status.emb b/BUILD
similarity index 74%
rename from examples/span_se_log_file_status.emb
rename to BUILD
index b0c1088..826db68 100644
--- a/examples/span_se_log_file_status.emb
+++ b/BUILD
@@ -1,21 +1,13 @@
 # Copyright 2019 Google LLC
-#
+# 
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at
-#
+# 
 #     https://www.apache.org/licenses/LICENSE-2.0
-#
+# 
 # Unless required by applicable law or agreed to in writing, software
 # distributed under the License is distributed on an "AS IS" BASIS,
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-
-[$default byte_order: "LittleEndian"]
-
-struct LogFileStatus:
-  0:4    UInt      file_state
-  4:16   UInt:8[12]  file_name
-  16:20  UInt      file_size_kb
-  20:24  UInt      media
diff --git a/public/build_defs.bzl b/build_defs.bzl
similarity index 72%
rename from public/build_defs.bzl
rename to build_defs.bzl
index caac8a7..cf03336 100644
--- a/public/build_defs.bzl
+++ b/build_defs.bzl
@@ -44,16 +44,16 @@
         name = name + "_header",
         tools = [
             # TODO(bolms): Make "emboss" driver program.
-            "//front_end:emboss_front_end",
-            "//back_end/cpp:emboss_codegen_cpp",
+            "//compiler/front_end:emboss_front_end",
+            "//compiler/back_end/cpp:emboss_codegen_cpp",
         ],
         srcs = srcs + [dep + "__emb" for dep in deps],
-        cmd = ("$(location //front_end:emboss_front_end) " +
+        cmd = ("$(location //compiler/front_end:emboss_front_end) " +
                "--output-ir-to-stdout " +
                "--import-dir=. " +
                "--import-dir='$(GENDIR)' " +
                "$(location {}) > $(@D)/$$(basename $(OUTS) .h).ir; " +
-               "$(location //back_end/cpp:emboss_codegen_cpp) " +
+               "$(location //compiler/back_end/cpp:emboss_codegen_cpp) " +
                "< $(@D)/$$(basename $(OUTS) .h).ir > " +
                "$(OUTS); " +
                "rm $(@D)/$$(basename $(OUTS) .h).ir").format(") $location( ".join(srcs)),
@@ -68,26 +68,7 @@
             ":" + name + "_header",
         ],
         deps = deps + [
-            "//public:cpp_utils",
+            "//runtime/cpp:cpp_utils",
         ],
         visibility = visibility,
     )
-
-# TODO(bolms): Maybe move this to a non-public build_defs?
-def emboss_cc_util_test(name, copts = [], **kwargs):
-    """Constructs two cc_test targets, with and without optimizations."""
-    native.cc_test(
-        name = name,
-        copts = copts + ["-Wsign-compare"],
-        **kwargs
-    )
-    native.cc_test(
-        name = name + "_no_opts",
-        copts = copts + [
-            # This is generally a dangerous flag for an individual target, but
-            # these tests do not depend on any other .cc files that might
-            # #include any Emboss headers.
-            "-DEMBOSS_NO_OPTIMIZATIONS",
-        ],
-        **kwargs
-    )
diff --git a/back_end/__init__.py b/compiler/back_end/__init__.py
similarity index 100%
rename from back_end/__init__.py
rename to compiler/back_end/__init__.py
diff --git a/back_end/cpp/BUILD b/compiler/back_end/cpp/BUILD
similarity index 95%
rename from back_end/cpp/BUILD
rename to compiler/back_end/cpp/BUILD
index 7a6f72e..b54d3ab 100644
--- a/back_end/cpp/BUILD
+++ b/compiler/back_end/cpp/BUILD
@@ -30,7 +30,7 @@
     visibility = ["//visibility:public"],
     deps = [
         ":header_generator",
-        "//public:ir_pb2",
+        "//compiler/util:ir_pb2",
     ],
 )
 
@@ -41,10 +41,10 @@
         "generated_code_templates",
     ],
     deps = [
-        "//back_end/util:code_template",
-        "//public:ir_pb2",
-        "//util:ir_util",
-        "//util:name_conversion",
+        "//compiler/back_end/util:code_template",
+        "//compiler/util:ir_pb2",
+        "//compiler/util:ir_util",
+        "//compiler/util:name_conversion",
     ],
 )
 
@@ -254,7 +254,7 @@
         "testcode/bits_test.cc",
     ],
     deps = [
-        "//public:cpp_utils",
+        "//runtime/cpp:cpp_utils",
         "//testdata:bits_emboss",
         "@com_google_googletest//:gtest_main",
     ],
@@ -266,7 +266,7 @@
         "testcode/anonymous_bits_test.cc",
     ],
     deps = [
-        "//public:cpp_utils",
+        "//runtime/cpp:cpp_utils",
         "//testdata:anonymous_bits_emboss",
         "@com_google_googletest//:gtest_main",
     ],
diff --git a/back_end/cpp/__init__.py b/compiler/back_end/cpp/__init__.py
similarity index 100%
rename from back_end/cpp/__init__.py
rename to compiler/back_end/cpp/__init__.py
diff --git a/back_end/cpp/build_defs.bzl b/compiler/back_end/cpp/build_defs.bzl
similarity index 100%
rename from back_end/cpp/build_defs.bzl
rename to compiler/back_end/cpp/build_defs.bzl
diff --git a/back_end/cpp/emboss_codegen_cpp.py b/compiler/back_end/cpp/emboss_codegen_cpp.py
similarity index 91%
rename from back_end/cpp/emboss_codegen_cpp.py
rename to compiler/back_end/cpp/emboss_codegen_cpp.py
index 1dbe5ad..b1d0f72 100644
--- a/back_end/cpp/emboss_codegen_cpp.py
+++ b/compiler/back_end/cpp/emboss_codegen_cpp.py
@@ -22,8 +22,8 @@
 
 import sys
 
-from back_end.cpp import header_generator
-from public import ir_pb2
+from compiler.back_end.cpp import header_generator
+from compiler.util import ir_pb2
 
 
 def main(argv):
diff --git a/back_end/cpp/generated_code_templates b/compiler/back_end/cpp/generated_code_templates
similarity index 99%
rename from back_end/cpp/generated_code_templates
rename to compiler/back_end/cpp/generated_code_templates
index dcecdd2..57c2b9c 100644
--- a/back_end/cpp/generated_code_templates
+++ b/compiler/back_end/cpp/generated_code_templates
@@ -33,7 +33,7 @@
 #include <type_traits>
 #include <utility>
 
-#include "public/emboss_cpp_util.h"
+#include "runtime/cpp/emboss_cpp_util.h"
 
 $_includes_$
 
diff --git a/back_end/cpp/header_generator.py b/compiler/back_end/cpp/header_generator.py
similarity index 99%
rename from back_end/cpp/header_generator.py
rename to compiler/back_end/cpp/header_generator.py
index d8a8804..9a4072d 100644
--- a/back_end/cpp/header_generator.py
+++ b/compiler/back_end/cpp/header_generator.py
@@ -22,13 +22,13 @@
 import pkgutil
 import re
 
-from back_end.util import code_template
-from public import ir_pb2
-from util import ir_util
-from util import name_conversion
+from compiler.back_end.util import code_template
+from compiler.util import ir_pb2
+from compiler.util import ir_util
+from compiler.util import name_conversion
 
 _TEMPLATES = code_template.parse_templates(pkgutil.get_data(
-    "back_end.cpp",
+    "compiler.back_end.cpp",
     "generated_code_templates").decode(encoding="UTF-8"))
 
 _CPP_RESERVED_WORDS = set((
@@ -63,7 +63,7 @@
 _SUPPORT_NAMESPACE = "::emboss::support"
 
 # TODO(bolms): This should be a command-line flag.
-_PRELUDE_INCLUDE_FILE = "public/emboss_prelude.h"
+_PRELUDE_INCLUDE_FILE = "runtime/cpp/emboss_prelude.h"
 
 
 def _get_module_namespace(module):
diff --git a/back_end/cpp/testcode/alignments_test.cc b/compiler/back_end/cpp/testcode/alignments_test.cc
similarity index 99%
rename from back_end/cpp/testcode/alignments_test.cc
rename to compiler/back_end/cpp/testcode/alignments_test.cc
index 0c5eef2..da54413 100644
--- a/back_end/cpp/testcode/alignments_test.cc
+++ b/compiler/back_end/cpp/testcode/alignments_test.cc
@@ -19,7 +19,7 @@
 #include <vector>
 
 #include "gtest/gtest.h"
-#include "public/emboss_cpp_util.h"
+#include "runtime/cpp/emboss_cpp_util.h"
 #include "testdata/alignments.emb.h"
 
 namespace emboss {
diff --git a/back_end/cpp/testcode/anonymous_bits_test.cc b/compiler/back_end/cpp/testcode/anonymous_bits_test.cc
similarity index 98%
rename from back_end/cpp/testcode/anonymous_bits_test.cc
rename to compiler/back_end/cpp/testcode/anonymous_bits_test.cc
index 8890a0c..15d8e1d 100644
--- a/back_end/cpp/testcode/anonymous_bits_test.cc
+++ b/compiler/back_end/cpp/testcode/anonymous_bits_test.cc
@@ -19,7 +19,7 @@
 #include <vector>
 
 #include "gtest/gtest.h"
-#include "public/emboss_cpp_util.h"
+#include "runtime/cpp/emboss_cpp_util.h"
 #include "testdata/anonymous_bits.emb.h"
 
 namespace emboss {
diff --git a/back_end/cpp/testcode/auto_array_size_test.cc b/compiler/back_end/cpp/testcode/auto_array_size_test.cc
similarity index 99%
rename from back_end/cpp/testcode/auto_array_size_test.cc
rename to compiler/back_end/cpp/testcode/auto_array_size_test.cc
index 56c9610..b220649 100644
--- a/back_end/cpp/testcode/auto_array_size_test.cc
+++ b/compiler/back_end/cpp/testcode/auto_array_size_test.cc
@@ -22,7 +22,7 @@
 
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
-#include "public/emboss_text_util.h"
+#include "runtime/cpp/emboss_text_util.h"
 #include "testdata/auto_array_size.emb.h"
 
 namespace emboss {
diff --git a/back_end/cpp/testcode/bcd_test.cc b/compiler/back_end/cpp/testcode/bcd_test.cc
similarity index 100%
rename from back_end/cpp/testcode/bcd_test.cc
rename to compiler/back_end/cpp/testcode/bcd_test.cc
diff --git a/back_end/cpp/testcode/bits_test.cc b/compiler/back_end/cpp/testcode/bits_test.cc
similarity index 99%
rename from back_end/cpp/testcode/bits_test.cc
rename to compiler/back_end/cpp/testcode/bits_test.cc
index 8d2b102..28e6397 100644
--- a/back_end/cpp/testcode/bits_test.cc
+++ b/compiler/back_end/cpp/testcode/bits_test.cc
@@ -18,7 +18,7 @@
 #include <vector>
 
 #include "gtest/gtest.h"
-#include "public/emboss_cpp_util.h"
+#include "runtime/cpp/emboss_cpp_util.h"
 #include "testdata/bits.emb.h"
 
 namespace emboss {
diff --git a/back_end/cpp/testcode/complex_structure_test.cc b/compiler/back_end/cpp/testcode/complex_structure_test.cc
similarity index 100%
rename from back_end/cpp/testcode/complex_structure_test.cc
rename to compiler/back_end/cpp/testcode/complex_structure_test.cc
diff --git a/back_end/cpp/testcode/condition_test.cc b/compiler/back_end/cpp/testcode/condition_test.cc
similarity index 100%
rename from back_end/cpp/testcode/condition_test.cc
rename to compiler/back_end/cpp/testcode/condition_test.cc
diff --git a/back_end/cpp/testcode/dynamic_size_test.cc b/compiler/back_end/cpp/testcode/dynamic_size_test.cc
similarity index 100%
rename from back_end/cpp/testcode/dynamic_size_test.cc
rename to compiler/back_end/cpp/testcode/dynamic_size_test.cc
diff --git a/back_end/cpp/testcode/enum_test.cc b/compiler/back_end/cpp/testcode/enum_test.cc
similarity index 100%
rename from back_end/cpp/testcode/enum_test.cc
rename to compiler/back_end/cpp/testcode/enum_test.cc
diff --git a/back_end/cpp/testcode/explicit_sizes_test.cc b/compiler/back_end/cpp/testcode/explicit_sizes_test.cc
similarity index 100%
rename from back_end/cpp/testcode/explicit_sizes_test.cc
rename to compiler/back_end/cpp/testcode/explicit_sizes_test.cc
diff --git a/back_end/cpp/testcode/float_test.cc b/compiler/back_end/cpp/testcode/float_test.cc
similarity index 100%
rename from back_end/cpp/testcode/float_test.cc
rename to compiler/back_end/cpp/testcode/float_test.cc
diff --git a/back_end/cpp/testcode/importer_test.cc b/compiler/back_end/cpp/testcode/importer_test.cc
similarity index 100%
rename from back_end/cpp/testcode/importer_test.cc
rename to compiler/back_end/cpp/testcode/importer_test.cc
diff --git a/back_end/cpp/testcode/inline_type_test.cc b/compiler/back_end/cpp/testcode/inline_type_test.cc
similarity index 100%
rename from back_end/cpp/testcode/inline_type_test.cc
rename to compiler/back_end/cpp/testcode/inline_type_test.cc
diff --git a/back_end/cpp/testcode/int_sizes_test.cc b/compiler/back_end/cpp/testcode/int_sizes_test.cc
similarity index 100%
rename from back_end/cpp/testcode/int_sizes_test.cc
rename to compiler/back_end/cpp/testcode/int_sizes_test.cc
diff --git a/back_end/cpp/testcode/namespace_test.cc b/compiler/back_end/cpp/testcode/namespace_test.cc
similarity index 100%
rename from back_end/cpp/testcode/namespace_test.cc
rename to compiler/back_end/cpp/testcode/namespace_test.cc
diff --git a/back_end/cpp/testcode/nested_structure_test.cc b/compiler/back_end/cpp/testcode/nested_structure_test.cc
similarity index 100%
rename from back_end/cpp/testcode/nested_structure_test.cc
rename to compiler/back_end/cpp/testcode/nested_structure_test.cc
diff --git a/back_end/cpp/testcode/parameters_test.cc b/compiler/back_end/cpp/testcode/parameters_test.cc
similarity index 100%
rename from back_end/cpp/testcode/parameters_test.cc
rename to compiler/back_end/cpp/testcode/parameters_test.cc
diff --git a/back_end/cpp/testcode/read_log_file_status_test.cc b/compiler/back_end/cpp/testcode/read_log_file_status_test.cc
similarity index 100%
rename from back_end/cpp/testcode/read_log_file_status_test.cc
rename to compiler/back_end/cpp/testcode/read_log_file_status_test.cc
diff --git a/back_end/cpp/testcode/requires_test.cc b/compiler/back_end/cpp/testcode/requires_test.cc
similarity index 100%
rename from back_end/cpp/testcode/requires_test.cc
rename to compiler/back_end/cpp/testcode/requires_test.cc
diff --git a/back_end/cpp/testcode/start_size_range_test.cc b/compiler/back_end/cpp/testcode/start_size_range_test.cc
similarity index 100%
rename from back_end/cpp/testcode/start_size_range_test.cc
rename to compiler/back_end/cpp/testcode/start_size_range_test.cc
diff --git a/back_end/cpp/testcode/subtypes_test.cc b/compiler/back_end/cpp/testcode/subtypes_test.cc
similarity index 100%
rename from back_end/cpp/testcode/subtypes_test.cc
rename to compiler/back_end/cpp/testcode/subtypes_test.cc
diff --git a/back_end/cpp/testcode/text_format_test.cc b/compiler/back_end/cpp/testcode/text_format_test.cc
similarity index 100%
rename from back_end/cpp/testcode/text_format_test.cc
rename to compiler/back_end/cpp/testcode/text_format_test.cc
diff --git a/back_end/cpp/testcode/uint_sizes_test.cc b/compiler/back_end/cpp/testcode/uint_sizes_test.cc
similarity index 100%
rename from back_end/cpp/testcode/uint_sizes_test.cc
rename to compiler/back_end/cpp/testcode/uint_sizes_test.cc
diff --git a/back_end/cpp/testcode/virtual_field_test.cc b/compiler/back_end/cpp/testcode/virtual_field_test.cc
similarity index 100%
rename from back_end/cpp/testcode/virtual_field_test.cc
rename to compiler/back_end/cpp/testcode/virtual_field_test.cc
diff --git a/back_end/util/BUILD b/compiler/back_end/util/BUILD
similarity index 93%
rename from back_end/util/BUILD
rename to compiler/back_end/util/BUILD
index c00631f..4598d2f 100644
--- a/back_end/util/BUILD
+++ b/compiler/back_end/util/BUILD
@@ -15,7 +15,7 @@
 # Shared utilities for Emboss back ends.
 
 package(
-    default_visibility = ["//back_end:__subpackages__"],
+    default_visibility = ["//compiler:__subpackages__"],
 )
 
 py_library(
diff --git a/back_end/util/__init__.py b/compiler/back_end/util/__init__.py
similarity index 100%
rename from back_end/util/__init__.py
rename to compiler/back_end/util/__init__.py
diff --git a/back_end/util/code_template.py b/compiler/back_end/util/code_template.py
similarity index 100%
rename from back_end/util/code_template.py
rename to compiler/back_end/util/code_template.py
diff --git a/back_end/util/code_template_test.py b/compiler/back_end/util/code_template_test.py
similarity index 98%
rename from back_end/util/code_template_test.py
rename to compiler/back_end/util/code_template_test.py
index 97322a2..31e1400 100644
--- a/back_end/util/code_template_test.py
+++ b/compiler/back_end/util/code_template_test.py
@@ -15,7 +15,7 @@
 """Tests for code_template."""
 
 import unittest
-from back_end.util import code_template
+from compiler.back_end.util import code_template
 
 
 class FormatTest(unittest.TestCase):
diff --git a/front_end/BUILD b/compiler/front_end/BUILD
similarity index 76%
rename from front_end/BUILD
rename to compiler/front_end/BUILD
index 07b96a2..14a4696 100644
--- a/front_end/BUILD
+++ b/compiler/front_end/BUILD
@@ -28,8 +28,8 @@
     name = "tokenizer",
     srcs = ["tokenizer.py"],
     deps = [
-        "//util:error",
-        "//util:parser_types",
+        "//compiler/util:error",
+        "//compiler/util:parser_types",
     ],
 )
 
@@ -39,8 +39,8 @@
     python_version = "PY3",
     deps = [
         ":tokenizer",
-        "//util:error",
-        "//util:parser_types",
+        "//compiler/util:error",
+        "//compiler/util:parser_types",
     ],
 )
 
@@ -48,7 +48,7 @@
     name = "lr1",
     srcs = ["lr1.py"],
     deps = [
-        "//util:parser_types",
+        "//compiler/util:parser_types",
     ],
 )
 
@@ -58,7 +58,7 @@
     python_version = "PY3",
     deps = [
         ":lr1",
-        "//util:parser_types",
+        "//compiler/util:parser_types",
     ],
 )
 
@@ -66,9 +66,9 @@
     name = "module_ir",
     srcs = ["module_ir.py"],
     deps = [
-        "//public:ir_pb2",
-        "//util:name_conversion",
-        "//util:parser_types",
+        "//compiler/util:ir_pb2",
+        "//compiler/util:name_conversion",
+        "//compiler/util:parser_types",
     ],
 )
 
@@ -84,7 +84,7 @@
         ":parser",
         ":test_util",
         ":tokenizer",
-        "//public:ir_pb2",
+        "//compiler/util:ir_pb2",
     ],
 )
 
@@ -98,7 +98,7 @@
         ":lr1",
         ":module_ir",
         ":tokenizer",
-        "//util:simple_memoizer",
+        "//compiler/util:simple_memoizer",
     ],
 )
 
@@ -110,7 +110,7 @@
         ":lr1",
         ":parser",
         ":tokenizer",
-        "//util:parser_types",
+        "//compiler/util:parser_types",
     ],
 )
 
@@ -128,8 +128,8 @@
     python_version = "PY3",
     deps = [
         ":test_util",
-        "//public:ir_pb2",
-        "//util:parser_types",
+        "//compiler/util:ir_pb2",
+        "//compiler/util:parser_types",
     ],
 )
 
@@ -153,9 +153,9 @@
         ":tokenizer",
         ":type_check",
         ":write_inference",
-        "//public:ir_pb2",
-        "//util:error",
-        "//util:parser_types",
+        "//compiler/util:ir_pb2",
+        "//compiler/util:error",
+        "//compiler/util:parser_types",
     ],
 )
 
@@ -169,9 +169,9 @@
     deps = [
         ":glue",
         ":test_util",
-        "//public:ir_pb2",
-        "//util:error",
-        "//util:parser_types",
+        "//compiler/util:ir_pb2",
+        "//compiler/util:error",
+        "//compiler/util:parser_types",
     ],
 )
 
@@ -180,9 +180,9 @@
     srcs = ["synthetics.py"],
     visibility = ["//visibility:private"],
     deps = [
-        "//public:ir_pb2",
-        "//util:expression_parser",
-        "//util:traverse_ir",
+        "//compiler/util:ir_pb2",
+        "//compiler/util:expression_parser",
+        "//compiler/util:traverse_ir",
     ],
 )
 
@@ -202,10 +202,10 @@
     srcs = ["symbol_resolver.py"],
     visibility = ["//visibility:private"],
     deps = [
-        "//public:ir_pb2",
-        "//util:error",
-        "//util:ir_util",
-        "//util:traverse_ir",
+        "//compiler/util:ir_pb2",
+        "//compiler/util:error",
+        "//compiler/util:ir_util",
+        "//compiler/util:traverse_ir",
     ],
 )
 
@@ -218,7 +218,7 @@
         ":glue",
         ":symbol_resolver",
         ":test_util",
-        "//util:error",
+        "//compiler/util:error",
     ],
 )
 
@@ -229,9 +229,9 @@
     deps = [
         ":attributes",
         ":expression_bounds",
-        "//public:ir_pb2",
-        "//util:ir_util",
-        "//util:traverse_ir",
+        "//compiler/util:ir_pb2",
+        "//compiler/util:ir_util",
+        "//compiler/util:traverse_ir",
     ],
 )
 
@@ -244,7 +244,7 @@
         ":glue",
         ":test_util",
         ":write_inference",
-        "//public:ir_pb2",
+        "//compiler/util:ir_pb2",
     ],
 )
 
@@ -254,10 +254,10 @@
     deps = [
         ":attributes",
         ":type_check",
-        "//public:ir_pb2",
-        "//util:error",
-        "//util:ir_util",
-        "//util:traverse_ir",
+        "//compiler/util:ir_pb2",
+        "//compiler/util:error",
+        "//compiler/util:ir_util",
+        "//compiler/util:traverse_ir",
     ],
 )
 
@@ -277,9 +277,9 @@
         ":attribute_checker",
         ":glue",
         ":test_util",
-        "//public:ir_pb2",
-        "//util:error",
-        "//util:ir_util",
+        "//compiler/util:ir_pb2",
+        "//compiler/util:error",
+        "//compiler/util:ir_util",
     ],
 )
 
@@ -288,10 +288,10 @@
     srcs = ["type_check.py"],
     deps = [
         ":attributes",
-        "//public:ir_pb2",
-        "//util:error",
-        "//util:ir_util",
-        "//util:traverse_ir",
+        "//compiler/util:ir_pb2",
+        "//compiler/util:error",
+        "//compiler/util:ir_util",
+        "//compiler/util:traverse_ir",
     ],
 )
 
@@ -304,7 +304,7 @@
         ":glue",
         ":test_util",
         ":type_check",
-        "//util:error",
+        "//compiler/util:error",
     ],
 )
 
@@ -316,9 +316,9 @@
     ],
     deps = [
         ":attributes",
-        "//public:ir_pb2",
-        "//util:ir_util",
-        "//util:traverse_ir",
+        "//compiler/util:ir_pb2",
+        "//compiler/util:ir_util",
+        "//compiler/util:traverse_ir",
     ],
 )
 
@@ -342,10 +342,10 @@
     ],
     deps = [
         ":attributes",
-        "//public:ir_pb2",
-        "//util:error",
-        "//util:ir_util",
-        "//util:traverse_ir",
+        "//compiler/util:ir_pb2",
+        "//compiler/util:error",
+        "//compiler/util:ir_util",
+        "//compiler/util:traverse_ir",
     ],
 )
 
@@ -358,7 +358,7 @@
         ":constraints",
         ":glue",
         ":test_util",
-        "//util:error",
+        "//compiler/util:error",
     ],
 )
 
@@ -366,10 +366,10 @@
     name = "dependency_checker",
     srcs = ["dependency_checker.py"],
     deps = [
-        "//public:ir_pb2",
-        "//util:error",
-        "//util:ir_util",
-        "//util:traverse_ir",
+        "//compiler/util:ir_pb2",
+        "//compiler/util:error",
+        "//compiler/util:ir_util",
+        "//compiler/util:traverse_ir",
     ],
 )
 
@@ -382,7 +382,7 @@
         ":dependency_checker",
         ":glue",
         ":test_util",
-        "//util:error",
+        "//compiler/util:error",
     ],
 )
 
@@ -394,7 +394,7 @@
     deps = [
         ":glue",
         ":module_ir",
-        "//util:error",
+        "//compiler/util:error",
     ],
 )
 
@@ -408,7 +408,7 @@
         ":format_emb",
         ":parser",
         ":tokenizer",
-        "//util:error",
+        "//compiler/util:error",
     ],
 )
 
@@ -418,7 +418,7 @@
     deps = [
         ":module_ir",
         ":tokenizer",
-        "//util:parser_types",
+        "//compiler/util:parser_types",
     ],
 )
 
@@ -452,7 +452,7 @@
     name = "docs_are_up_to_date_test",
     srcs = ["docs_are_up_to_date_test.py"],
     data = [
-        "//g3doc:grammar_md",
+        "//doc:grammar_md",
     ],
     python_version = "PY3",
     deps = [
diff --git a/front_end/__init__.py b/compiler/front_end/__init__.py
similarity index 100%
rename from front_end/__init__.py
rename to compiler/front_end/__init__.py
diff --git a/front_end/attribute_checker.py b/compiler/front_end/attribute_checker.py
similarity index 98%
rename from front_end/attribute_checker.py
rename to compiler/front_end/attribute_checker.py
index b1e4072..faba299 100644
--- a/front_end/attribute_checker.py
+++ b/compiler/front_end/attribute_checker.py
@@ -18,12 +18,12 @@
 verifies attributes which may have been manually entered.
 """
 
-from front_end import attributes
-from front_end import type_check
-from public import ir_pb2
-from util import error
-from util import ir_util
-from util import traverse_ir
+from compiler.front_end import attributes
+from compiler.front_end import type_check
+from compiler.util import ir_pb2
+from compiler.util import error
+from compiler.util import ir_util
+from compiler.util import traverse_ir
 
 # The "namespace" attribute is C++-back-end specific, and so should not be used
 # by the front end.
diff --git a/front_end/attribute_checker_test.py b/compiler/front_end/attribute_checker_test.py
similarity index 98%
rename from front_end/attribute_checker_test.py
rename to compiler/front_end/attribute_checker_test.py
index f9a6cfc..225a85e 100644
--- a/front_end/attribute_checker_test.py
+++ b/compiler/front_end/attribute_checker_test.py
@@ -15,12 +15,12 @@
 """Tests for attribute_checker.py."""
 
 import unittest
-from front_end import attribute_checker
-from front_end import glue
-from front_end import test_util
-from public import ir_pb2
-from util import error
-from util import ir_util
+from compiler.front_end import attribute_checker
+from compiler.front_end import glue
+from compiler.front_end import test_util
+from compiler.util import ir_pb2
+from compiler.util import error
+from compiler.util import ir_util
 
 # These are not shared with attribute_checker.py because their values are part
 # of the contract with back ends.
diff --git a/front_end/attributes.py b/compiler/front_end/attributes.py
similarity index 100%
rename from front_end/attributes.py
rename to compiler/front_end/attributes.py
diff --git a/front_end/constraints.py b/compiler/front_end/constraints.py
similarity index 98%
rename from front_end/constraints.py
rename to compiler/front_end/constraints.py
index a8628a1..8494757 100644
--- a/front_end/constraints.py
+++ b/compiler/front_end/constraints.py
@@ -16,11 +16,11 @@
 
 import pkgutil
 
-from front_end import attributes
-from public import ir_pb2
-from util import error
-from util import ir_util
-from util import traverse_ir
+from compiler.front_end import attributes
+from compiler.util import ir_pb2
+from compiler.util import error
+from compiler.util import ir_util
+from compiler.util import traverse_ir
 
 
 def _render_type(type_ir, ir):
@@ -396,7 +396,7 @@
   _RESERVED_WORDS = {}
   language = None
   for line in pkgutil.get_data(
-      "front_end",
+      "compiler.front_end",
       "reserved_words").decode(encoding="UTF-8").splitlines():
     stripped_line = line.partition("#")[0].strip()
     if not stripped_line:
diff --git a/front_end/constraints_test.py b/compiler/front_end/constraints_test.py
similarity index 98%
rename from front_end/constraints_test.py
rename to compiler/front_end/constraints_test.py
index 1f12dc8..ff33586 100644
--- a/front_end/constraints_test.py
+++ b/compiler/front_end/constraints_test.py
@@ -15,12 +15,12 @@
 """Tests for constraints.py."""
 
 import unittest
-from front_end import attributes
-from front_end import constraints
-from front_end import glue
-from front_end import test_util
-from util import error
-from util import ir_util
+from compiler.front_end import attributes
+from compiler.front_end import constraints
+from compiler.front_end import glue
+from compiler.front_end import test_util
+from compiler.util import error
+from compiler.util import ir_util
 
 
 def _make_ir_from_emb(emb_text, name="m.emb"):
diff --git a/front_end/dependency_checker.py b/compiler/front_end/dependency_checker.py
similarity index 98%
rename from front_end/dependency_checker.py
rename to compiler/front_end/dependency_checker.py
index 7a1fa7d..b37dff2 100644
--- a/front_end/dependency_checker.py
+++ b/compiler/front_end/dependency_checker.py
@@ -14,10 +14,10 @@
 
 """Checks for dependency cycles in Emboss IR."""
 
-from public import ir_pb2
-from util import error
-from util import ir_util
-from util import traverse_ir
+from compiler.util import ir_pb2
+from compiler.util import error
+from compiler.util import ir_util
+from compiler.util import traverse_ir
 
 
 def _add_reference_to_dependencies(reference, dependencies, name):
diff --git a/front_end/dependency_checker_test.py b/compiler/front_end/dependency_checker_test.py
similarity index 98%
rename from front_end/dependency_checker_test.py
rename to compiler/front_end/dependency_checker_test.py
index 2639db7..ba7ceb7 100644
--- a/front_end/dependency_checker_test.py
+++ b/compiler/front_end/dependency_checker_test.py
@@ -15,10 +15,10 @@
 """Tests for dependency_checker.py."""
 
 import unittest
-from front_end import dependency_checker
-from front_end import glue
-from front_end import test_util
-from util import error
+from compiler.front_end import dependency_checker
+from compiler.front_end import glue
+from compiler.front_end import test_util
+from compiler.util import error
 
 
 def _parse_snippet(emb_file):
diff --git a/front_end/docs_are_up_to_date_test.py b/compiler/front_end/docs_are_up_to_date_test.py
similarity index 90%
rename from front_end/docs_are_up_to_date_test.py
rename to compiler/front_end/docs_are_up_to_date_test.py
index ded2b55..d103d17 100644
--- a/front_end/docs_are_up_to_date_test.py
+++ b/compiler/front_end/docs_are_up_to_date_test.py
@@ -17,14 +17,14 @@
 import pkgutil
 
 import unittest
-from front_end import generate_grammar_md
+from compiler.front_end import generate_grammar_md
 
 
 class DocsAreUpToDateTest(unittest.TestCase):
   """Tests that auto-generated, checked-in documentation is up to date."""
 
   def test_grammar_md(self):
-    doc_md = pkgutil.get_data("g3doc", "grammar.md").decode(encoding="UTF-8")
+    doc_md = pkgutil.get_data("doc", "grammar.md").decode(encoding="UTF-8")
     correct_md = generate_grammar_md.generate_grammar_md()
     # If this fails, run:
     #
diff --git a/front_end/emboss_front_end.py b/compiler/front_end/emboss_front_end.py
similarity index 98%
rename from front_end/emboss_front_end.py
rename to compiler/front_end/emboss_front_end.py
index 1002d3e..aa74eb7 100644
--- a/front_end/emboss_front_end.py
+++ b/compiler/front_end/emboss_front_end.py
@@ -27,9 +27,9 @@
 from os import path
 import sys
 
-from front_end import glue
-from front_end import module_ir
-from util import error
+from compiler.front_end import glue
+from compiler.front_end import module_ir
+from compiler.util import error
 
 
 def _parse_command_line(argv):
diff --git a/front_end/error_examples b/compiler/front_end/error_examples
similarity index 100%
rename from front_end/error_examples
rename to compiler/front_end/error_examples
diff --git a/front_end/expression_bounds.py b/compiler/front_end/expression_bounds.py
similarity index 99%
rename from front_end/expression_bounds.py
rename to compiler/front_end/expression_bounds.py
index 8ea53f3..7191ada 100644
--- a/front_end/expression_bounds.py
+++ b/compiler/front_end/expression_bounds.py
@@ -17,9 +17,9 @@
 import fractions
 import operator
 
-from public import ir_pb2
-from util import ir_util
-from util import traverse_ir
+from compiler.util import ir_pb2
+from compiler.util import ir_util
+from compiler.util import traverse_ir
 
 
 def compute_constraints_of_expression(expression, ir):
diff --git a/front_end/expression_bounds_test.py b/compiler/front_end/expression_bounds_test.py
similarity index 99%
rename from front_end/expression_bounds_test.py
rename to compiler/front_end/expression_bounds_test.py
index 64f1530..15870b4 100644
--- a/front_end/expression_bounds_test.py
+++ b/compiler/front_end/expression_bounds_test.py
@@ -15,9 +15,9 @@
 """Tests for expression_bounds."""
 
 import unittest
-from front_end import expression_bounds
-from front_end import glue
-from front_end import test_util
+from compiler.front_end import expression_bounds
+from compiler.front_end import glue
+from compiler.front_end import test_util
 
 
 class ComputeConstantsTest(unittest.TestCase):
diff --git a/front_end/format.py b/compiler/front_end/format.py
similarity index 96%
rename from front_end/format.py
rename to compiler/front_end/format.py
index 862177c..1e2389b 100644
--- a/front_end/format.py
+++ b/compiler/front_end/format.py
@@ -24,10 +24,10 @@
 import os
 import sys
 
-from front_end import format_emb
-from front_end import parser
-from front_end import tokenizer
-from util import error
+from compiler.front_end import format_emb
+from compiler.front_end import parser
+from compiler.front_end import tokenizer
+from compiler.util import error
 
 
 def _parse_command_line(argv):
diff --git a/front_end/format_emb.py b/compiler/front_end/format_emb.py
similarity index 99%
rename from front_end/format_emb.py
rename to compiler/front_end/format_emb.py
index 1824c85..3ddd20e 100644
--- a/front_end/format_emb.py
+++ b/compiler/front_end/format_emb.py
@@ -23,9 +23,9 @@
 import collections
 import itertools
 
-from front_end import module_ir
-from front_end import tokenizer
-from util import parser_types
+from compiler.front_end import module_ir
+from compiler.front_end import tokenizer
+from compiler.util import parser_types
 
 
 class Config(collections.namedtuple('Config',
diff --git a/front_end/format_emb_test.py b/compiler/front_end/format_emb_test.py
similarity index 97%
rename from front_end/format_emb_test.py
rename to compiler/front_end/format_emb_test.py
index 75ce19d..a114315 100644
--- a/front_end/format_emb_test.py
+++ b/compiler/front_end/format_emb_test.py
@@ -23,10 +23,10 @@
 import sys
 
 import unittest
-from front_end import format_emb
-from front_end import module_ir
-from front_end import parser
-from front_end import tokenizer
+from compiler.front_end import format_emb
+from compiler.front_end import module_ir
+from compiler.front_end import parser
+from compiler.front_end import tokenizer
 
 
 class SanityCheckerTest(unittest.TestCase):
diff --git a/front_end/generate_grammar_md.py b/compiler/front_end/generate_grammar_md.py
similarity index 98%
rename from front_end/generate_grammar_md.py
rename to compiler/front_end/generate_grammar_md.py
index 62a9475..6cb2c58 100644
--- a/front_end/generate_grammar_md.py
+++ b/compiler/front_end/generate_grammar_md.py
@@ -19,9 +19,9 @@
 import re
 import sys
 
-from front_end import constraints
-from front_end import module_ir
-from front_end import tokenizer
+from compiler.front_end import constraints
+from compiler.front_end import module_ir
+from compiler.front_end import tokenizer
 
 # Keep the output to less than 80 columns, so that the preformatted sections are
 # not cut off.
diff --git a/front_end/glue.py b/compiler/front_end/glue.py
similarity index 94%
rename from front_end/glue.py
rename to compiler/front_end/glue.py
index 691b126..10c4365 100644
--- a/front_end/glue.py
+++ b/compiler/front_end/glue.py
@@ -21,21 +21,21 @@
 import collections
 import pkgutil
 
-from front_end import attribute_checker
-from front_end import constraints
-from front_end import dependency_checker
-from front_end import expression_bounds
-from front_end import lr1
-from front_end import module_ir
-from front_end import parser
-from front_end import symbol_resolver
-from front_end import synthetics
-from front_end import tokenizer
-from front_end import type_check
-from front_end import write_inference
-from public import ir_pb2
-from util import error
-from util import parser_types
+from compiler.front_end import attribute_checker
+from compiler.front_end import constraints
+from compiler.front_end import dependency_checker
+from compiler.front_end import expression_bounds
+from compiler.front_end import lr1
+from compiler.front_end import module_ir
+from compiler.front_end import parser
+from compiler.front_end import symbol_resolver
+from compiler.front_end import synthetics
+from compiler.front_end import tokenizer
+from compiler.front_end import type_check
+from compiler.front_end import write_inference
+from compiler.util import ir_pb2
+from compiler.util import error
+from compiler.util import parser_types
 
 _IrDebugInfo = collections.namedtuple("IrDebugInfo", ["ir", "debug_info",
                                                       "errors"])
@@ -201,7 +201,7 @@
 def get_prelude():
   """Returns the module IR and debug info of the Emboss Prelude."""
   return parse_module_text(
-      pkgutil.get_data("front_end",
+      pkgutil.get_data("compiler.front_end",
                        "prelude.emb").decode(encoding="UTF-8"),
       "")
 
diff --git a/front_end/glue_test.py b/compiler/front_end/glue_test.py
similarity index 98%
rename from front_end/glue_test.py
rename to compiler/front_end/glue_test.py
index 7bc03f5..41c4864 100644
--- a/front_end/glue_test.py
+++ b/compiler/front_end/glue_test.py
@@ -17,11 +17,11 @@
 import pkgutil
 import unittest
 
-from front_end import glue
-from front_end import test_util
-from public import ir_pb2
-from util import error
-from util import parser_types
+from compiler.front_end import glue
+from compiler.front_end import test_util
+from compiler.util import ir_pb2
+from compiler.util import error
+from compiler.util import parser_types
 
 _location = parser_types.make_location
 
diff --git a/front_end/lr1.py b/compiler/front_end/lr1.py
similarity index 99%
rename from front_end/lr1.py
rename to compiler/front_end/lr1.py
index 112bf12..41111d1 100644
--- a/front_end/lr1.py
+++ b/compiler/front_end/lr1.py
@@ -28,7 +28,7 @@
 
 import collections
 
-from util import parser_types
+from compiler.util import parser_types
 
 
 class Item(collections.namedtuple("Item", ["production", "dot", "terminal",
diff --git a/front_end/lr1_test.py b/compiler/front_end/lr1_test.py
similarity index 99%
rename from front_end/lr1_test.py
rename to compiler/front_end/lr1_test.py
index 7573856..44ffa75 100644
--- a/front_end/lr1_test.py
+++ b/compiler/front_end/lr1_test.py
@@ -17,8 +17,8 @@
 import collections
 import unittest
 
-from front_end import lr1
-from util import parser_types
+from compiler.front_end import lr1
+from compiler.util import parser_types
 
 
 def _make_items(text):
diff --git a/front_end/module_ir.py b/compiler/front_end/module_ir.py
similarity index 99%
rename from front_end/module_ir.py
rename to compiler/front_end/module_ir.py
index 0be34be..aea005c 100644
--- a/front_end/module_ir.py
+++ b/compiler/front_end/module_ir.py
@@ -25,9 +25,9 @@
 import re
 import sys
 
-from public import ir_pb2
-from util import name_conversion
-from util import parser_types
+from compiler.util import ir_pb2
+from compiler.util import name_conversion
+from compiler.util import parser_types
 
 
 # Intermediate types; should not be found in the final IR.
diff --git a/front_end/module_ir_test.py b/compiler/front_end/module_ir_test.py
similarity index 99%
rename from front_end/module_ir_test.py
rename to compiler/front_end/module_ir_test.py
index e19ed79..c9249b4 100644
--- a/front_end/module_ir_test.py
+++ b/compiler/front_end/module_ir_test.py
@@ -20,11 +20,11 @@
 import pkgutil
 import unittest
 
-from front_end import module_ir
-from front_end import parser
-from front_end import test_util
-from front_end import tokenizer
-from public import ir_pb2
+from compiler.front_end import module_ir
+from compiler.front_end import parser
+from compiler.front_end import test_util
+from compiler.front_end import tokenizer
+from compiler.util import ir_pb2
 
 _TESTDATA_PATH = "testdata.golden"
 _MINIMAL_SAMPLE = parser.parse_module(
diff --git a/front_end/parser.py b/compiler/front_end/parser.py
similarity index 95%
rename from front_end/parser.py
rename to compiler/front_end/parser.py
index 9ef5eb1..600b644 100644
--- a/front_end/parser.py
+++ b/compiler/front_end/parser.py
@@ -16,10 +16,10 @@
 
 import pkgutil
 
-from front_end import lr1
-from front_end import module_ir
-from front_end import tokenizer
-from util import simple_memoizer
+from compiler.front_end import lr1
+from compiler.front_end import module_ir
+from compiler.front_end import tokenizer
+from compiler.util import simple_memoizer
 
 
 class ParserGenerationError(Exception):
@@ -104,7 +104,7 @@
 
 @simple_memoizer.memoize
 def _load_module_parser():
-  path = "front_end"
+  path = "compiler.front_end"
   error_examples = parse_error_examples(
       pkgutil.get_data(path, "error_examples").decode("utf-8"))
   return generate_parser(module_ir.START_SYMBOL, module_ir.PRODUCTIONS,
diff --git a/front_end/parser_test.py b/compiler/front_end/parser_test.py
similarity index 97%
rename from front_end/parser_test.py
rename to compiler/front_end/parser_test.py
index e3f6579..06cfd03 100644
--- a/front_end/parser_test.py
+++ b/compiler/front_end/parser_test.py
@@ -15,10 +15,10 @@
 """Tests for parser."""
 
 import unittest
-from front_end import lr1
-from front_end import parser
-from front_end import tokenizer
-from util import parser_types
+from compiler.front_end import lr1
+from compiler.front_end import parser
+from compiler.front_end import tokenizer
+from compiler.util import parser_types
 
 
 # TODO(bolms): This is repeated in lr1_test.py; separate into test utils?
diff --git a/front_end/prelude.emb b/compiler/front_end/prelude.emb
similarity index 100%
rename from front_end/prelude.emb
rename to compiler/front_end/prelude.emb
diff --git a/front_end/reserved_words b/compiler/front_end/reserved_words
similarity index 100%
rename from front_end/reserved_words
rename to compiler/front_end/reserved_words
diff --git a/front_end/symbol_resolver.py b/compiler/front_end/symbol_resolver.py
similarity index 99%
rename from front_end/symbol_resolver.py
rename to compiler/front_end/symbol_resolver.py
index e059275..987b869 100644
--- a/front_end/symbol_resolver.py
+++ b/compiler/front_end/symbol_resolver.py
@@ -20,10 +20,10 @@
 
 import collections
 
-from public import ir_pb2
-from util import error
-from util import ir_util
-from util import traverse_ir
+from compiler.util import ir_pb2
+from compiler.util import error
+from compiler.util import ir_util
+from compiler.util import traverse_ir
 
 # TODO(bolms): Symbol resolution raises an exception at the first error, but
 # this is one place where it can make sense to report multiple errors.
diff --git a/front_end/symbol_resolver_test.py b/compiler/front_end/symbol_resolver_test.py
similarity index 99%
rename from front_end/symbol_resolver_test.py
rename to compiler/front_end/symbol_resolver_test.py
index a2f7f4e..4428f26 100644
--- a/front_end/symbol_resolver_test.py
+++ b/compiler/front_end/symbol_resolver_test.py
@@ -15,10 +15,10 @@
 """Tests for emboss.front_end.symbol_resolver."""
 
 import unittest
-from front_end import glue
-from front_end import symbol_resolver
-from front_end import test_util
-from util import error
+from compiler.front_end import glue
+from compiler.front_end import symbol_resolver
+from compiler.front_end import test_util
+from compiler.util import error
 
 _HAPPY_EMB = """
 struct Foo:
diff --git a/front_end/synthetics.py b/compiler/front_end/synthetics.py
similarity index 97%
rename from front_end/synthetics.py
rename to compiler/front_end/synthetics.py
index 04e535f..c0dbcab 100644
--- a/front_end/synthetics.py
+++ b/compiler/front_end/synthetics.py
@@ -14,11 +14,11 @@
 
 """Adds auto-generated virtual fields to the IR."""
 
-from front_end import attributes
-from public import ir_pb2
-from util import expression_parser
-from util import ir_util
-from util import traverse_ir
+from compiler.front_end import attributes
+from compiler.util import ir_pb2
+from compiler.util import expression_parser
+from compiler.util import ir_util
+from compiler.util import traverse_ir
 
 
 def _mark_as_synthetic(proto):
diff --git a/front_end/synthetics_test.py b/compiler/front_end/synthetics_test.py
similarity index 98%
rename from front_end/synthetics_test.py
rename to compiler/front_end/synthetics_test.py
index 10a23d3..3d3f9a5 100644
--- a/front_end/synthetics_test.py
+++ b/compiler/front_end/synthetics_test.py
@@ -15,10 +15,10 @@
 """Tests for front_end.synthetics."""
 
 import unittest
-from front_end import glue
-from front_end import synthetics
-from front_end import test_util
-from public import ir_pb2
+from compiler.front_end import glue
+from compiler.front_end import synthetics
+from compiler.front_end import test_util
+from compiler.util import ir_pb2
 
 
 class SyntheticsTest(unittest.TestCase):
diff --git a/front_end/test_util.py b/compiler/front_end/test_util.py
similarity index 98%
rename from front_end/test_util.py
rename to compiler/front_end/test_util.py
index 1bbdd35..dd80343 100644
--- a/front_end/test_util.py
+++ b/compiler/front_end/test_util.py
@@ -14,7 +14,7 @@
 
 """Utilities for test code."""
 
-from public import ir_pb2
+from compiler.util import ir_pb2
 
 
 def proto_is_superset(proto, expected_values, path=""):
diff --git a/front_end/test_util_test.py b/compiler/front_end/test_util_test.py
similarity index 97%
rename from front_end/test_util_test.py
rename to compiler/front_end/test_util_test.py
index 89c7c9f..c5ba61b 100644
--- a/front_end/test_util_test.py
+++ b/compiler/front_end/test_util_test.py
@@ -16,9 +16,9 @@
 
 import unittest
 
-from front_end import test_util
-from public import ir_pb2
-from util import parser_types
+from compiler.front_end import test_util
+from compiler.util import ir_pb2
+from compiler.util import parser_types
 
 
 class ProtoIsSupersetTest(unittest.TestCase):
diff --git a/front_end/tokenizer.py b/compiler/front_end/tokenizer.py
similarity index 98%
rename from front_end/tokenizer.py
rename to compiler/front_end/tokenizer.py
index a9d005a..4262371 100644
--- a/front_end/tokenizer.py
+++ b/compiler/front_end/tokenizer.py
@@ -31,8 +31,8 @@
 import collections
 import re
 
-from util import error
-from util import parser_types
+from compiler.util import error
+from compiler.util import parser_types
 
 
 def tokenize(text, file_name):
diff --git a/front_end/tokenizer_test.py b/compiler/front_end/tokenizer_test.py
similarity index 98%
rename from front_end/tokenizer_test.py
rename to compiler/front_end/tokenizer_test.py
index 97b1494..91e1b3b 100644
--- a/front_end/tokenizer_test.py
+++ b/compiler/front_end/tokenizer_test.py
@@ -15,9 +15,9 @@
 """Tests for tokenizer."""
 
 import unittest
-from front_end import tokenizer
-from util import error
-from util import parser_types
+from compiler.front_end import tokenizer
+from compiler.util import error
+from compiler.util import parser_types
 
 
 def _token_symbols(token_list):
diff --git a/front_end/type_check.py b/compiler/front_end/type_check.py
similarity index 98%
rename from front_end/type_check.py
rename to compiler/front_end/type_check.py
index 141880f..69e0716 100644
--- a/front_end/type_check.py
+++ b/compiler/front_end/type_check.py
@@ -14,11 +14,11 @@
 
 """Functions for checking expression types."""
 
-from front_end import attributes
-from public import ir_pb2
-from util import error
-from util import ir_util
-from util import traverse_ir
+from compiler.front_end import attributes
+from compiler.util import ir_pb2
+from compiler.util import error
+from compiler.util import ir_util
+from compiler.util import traverse_ir
 
 
 def _type_check_expression(expression, source_file_name, ir, errors):
diff --git a/front_end/type_check_test.py b/compiler/front_end/type_check_test.py
similarity index 99%
rename from front_end/type_check_test.py
rename to compiler/front_end/type_check_test.py
index 16defc9..6faaa25 100644
--- a/front_end/type_check_test.py
+++ b/compiler/front_end/type_check_test.py
@@ -15,10 +15,10 @@
 """Tests for front_end.type_check."""
 
 import unittest
-from front_end import glue
-from front_end import test_util
-from front_end import type_check
-from util import error
+from compiler.front_end import glue
+from compiler.front_end import test_util
+from compiler.front_end import type_check
+from compiler.util import error
 
 
 class TypeAnnotationTest(unittest.TestCase):
diff --git a/front_end/write_inference.py b/compiler/front_end/write_inference.py
similarity index 97%
rename from front_end/write_inference.py
rename to compiler/front_end/write_inference.py
index bef4ac6..09501f0 100644
--- a/front_end/write_inference.py
+++ b/compiler/front_end/write_inference.py
@@ -14,11 +14,11 @@
 
 """Adds auto-generated virtual fields to the IR."""
 
-from front_end import attributes
-from front_end import expression_bounds
-from public import ir_pb2
-from util import ir_util
-from util import traverse_ir
+from compiler.front_end import attributes
+from compiler.front_end import expression_bounds
+from compiler.util import ir_pb2
+from compiler.util import ir_util
+from compiler.util import traverse_ir
 
 
 def _find_field_reference_path(expression):
diff --git a/front_end/write_inference_test.py b/compiler/front_end/write_inference_test.py
similarity index 97%
rename from front_end/write_inference_test.py
rename to compiler/front_end/write_inference_test.py
index 71cfc53..0928d94 100644
--- a/front_end/write_inference_test.py
+++ b/compiler/front_end/write_inference_test.py
@@ -15,10 +15,10 @@
 """Tests for ...emboss.front_end.write_inference."""
 
 import unittest
-from front_end import glue
-from front_end import test_util
-from front_end import write_inference
-from public import ir_pb2
+from compiler.front_end import glue
+from compiler.front_end import test_util
+from compiler.front_end import write_inference
+from compiler.util import ir_pb2
 
 
 class WriteInferenceTest(unittest.TestCase):
diff --git a/util/BUILD b/compiler/util/BUILD
similarity index 85%
rename from util/BUILD
rename to compiler/util/BUILD
index eec0cd4..92f4cde 100644
--- a/util/BUILD
+++ b/compiler/util/BUILD
@@ -15,23 +15,30 @@
 # Shared utilities for Emboss back ends.
 
 package(
-    default_visibility = ["//:__subpackages__"],
+    default_visibility = ["//compiler:__subpackages__"],
+)
+
+py_library(
+    name = "ir_pb2",
+    srcs = [
+        "ir_pb2.py",
+    ],
 )
 
 py_library(
     name = "expression_parser",
     srcs = ["expression_parser.py"],
     deps = [
-        "//front_end:module_ir",
-        "//front_end:parser",
-        "//front_end:tokenizer",
+        "//compiler/front_end:module_ir",
+        "//compiler/front_end:parser",
+        "//compiler/front_end:tokenizer",
     ],
 )
 
 py_library(
     name = "ir_util",
     srcs = ["ir_util.py"],
-    deps = ["//public:ir_pb2"],
+    deps = [":ir_pb2"],
 )
 
 py_test(
@@ -41,7 +48,7 @@
     deps = [
         ":expression_parser",
         ":ir_util",
-        "//public:ir_pb2",
+        ":ir_pb2",
     ],
 )
 
@@ -65,7 +72,7 @@
     srcs = ["traverse_ir.py"],
     deps = [
         ":simple_memoizer",
-        "//public:ir_pb2",
+        ":ir_pb2",
     ],
 )
 
@@ -75,7 +82,7 @@
     python_version = "PY3",
     deps = [
         ":traverse_ir",
-        "//public:ir_pb2",
+        ":ir_pb2",
     ],
 )
 
@@ -83,7 +90,7 @@
     name = "parser_types",
     srcs = ["parser_types.py"],
     deps = [
-        "//public:ir_pb2",
+        ":ir_pb2",
     ],
 )
 
@@ -93,7 +100,7 @@
     python_version = "PY3",
     deps = [
         ":parser_types",
-        "//public:ir_pb2",
+        ":ir_pb2",
     ],
 )
 
diff --git a/util/error.py b/compiler/util/error.py
similarity index 99%
rename from util/error.py
rename to compiler/util/error.py
index 5a49e70..c85d8fc 100644
--- a/util/error.py
+++ b/compiler/util/error.py
@@ -36,7 +36,7 @@
     ]
 """
 
-from util import parser_types
+from compiler.util import parser_types
 
 # Error levels; represented by the strings that will be included in messages.
 ERROR = "error"
diff --git a/util/error_test.py b/compiler/util/error_test.py
similarity index 99%
rename from util/error_test.py
rename to compiler/util/error_test.py
index ee36419..7d2577f 100644
--- a/util/error_test.py
+++ b/compiler/util/error_test.py
@@ -16,8 +16,8 @@
 
 import unittest
 
-from util import error
-from util import parser_types
+from compiler.util import error
+from compiler.util import parser_types
 
 
 class MessageTest(unittest.TestCase):
diff --git a/util/expression_parser.py b/compiler/util/expression_parser.py
similarity index 93%
rename from util/expression_parser.py
rename to compiler/util/expression_parser.py
index 6b7cc0e..41dd488 100644
--- a/util/expression_parser.py
+++ b/compiler/util/expression_parser.py
@@ -14,9 +14,9 @@
 
 """Utility function to parse text into an ir_pb2.Expression."""
 
-from front_end import module_ir
-from front_end import parser
-from front_end import tokenizer
+from compiler.front_end import module_ir
+from compiler.front_end import parser
+from compiler.front_end import tokenizer
 
 
 def parse(text):
diff --git a/public/ir_pb2.py b/compiler/util/ir_pb2.py
similarity index 100%
rename from public/ir_pb2.py
rename to compiler/util/ir_pb2.py
diff --git a/util/ir_util.py b/compiler/util/ir_util.py
similarity index 99%
rename from util/ir_util.py
rename to compiler/util/ir_util.py
index aa06229..4000e70 100644
--- a/util/ir_util.py
+++ b/compiler/util/ir_util.py
@@ -16,7 +16,7 @@
 
 import operator
 
-from public import ir_pb2
+from compiler.util import ir_pb2
 
 
 _FIXED_SIZE_ATTRIBUTE = "fixed_size_in_bits"
diff --git a/util/ir_util_test.py b/compiler/util/ir_util_test.py
similarity index 99%
rename from util/ir_util_test.py
rename to compiler/util/ir_util_test.py
index 81719af..b9d8d84 100644
--- a/util/ir_util_test.py
+++ b/compiler/util/ir_util_test.py
@@ -15,9 +15,9 @@
 """Tests for util.ir_util."""
 
 import unittest
-from public import ir_pb2
-from util import expression_parser
-from util import ir_util
+from compiler.util import ir_pb2
+from compiler.util import expression_parser
+from compiler.util import ir_util
 
 
 def _parse_expression(text):
diff --git a/util/name_conversion.py b/compiler/util/name_conversion.py
similarity index 100%
rename from util/name_conversion.py
rename to compiler/util/name_conversion.py
diff --git a/util/name_conversion_test.py b/compiler/util/name_conversion_test.py
similarity index 96%
rename from util/name_conversion_test.py
rename to compiler/util/name_conversion_test.py
index 5a423e3..a980a1d 100644
--- a/util/name_conversion_test.py
+++ b/compiler/util/name_conversion_test.py
@@ -15,7 +15,7 @@
 """Tests for util.name_conversion."""
 
 import unittest
-from util import name_conversion
+from compiler.util import name_conversion
 
 
 class NameConversionTest(unittest.TestCase):
diff --git a/util/parser_types.py b/compiler/util/parser_types.py
similarity index 98%
rename from util/parser_types.py
rename to compiler/util/parser_types.py
index b934eb9..98c8ee2 100644
--- a/util/parser_types.py
+++ b/compiler/util/parser_types.py
@@ -21,7 +21,7 @@
 """
 
 import collections
-from public import ir_pb2
+from compiler.util import ir_pb2
 
 
 def _make_position(line, column):
diff --git a/util/parser_types_test.py b/compiler/util/parser_types_test.py
similarity index 98%
rename from util/parser_types_test.py
rename to compiler/util/parser_types_test.py
index 03109d5..6dbfffb 100644
--- a/util/parser_types_test.py
+++ b/compiler/util/parser_types_test.py
@@ -15,8 +15,8 @@
 """Tests for parser_types."""
 
 import unittest
-from public import ir_pb2
-from util import parser_types
+from compiler.util import ir_pb2
+from compiler.util import parser_types
 
 
 class PositionTest(unittest.TestCase):
diff --git a/util/simple_memoizer.py b/compiler/util/simple_memoizer.py
similarity index 100%
rename from util/simple_memoizer.py
rename to compiler/util/simple_memoizer.py
diff --git a/util/simple_memoizer_test.py b/compiler/util/simple_memoizer_test.py
similarity index 97%
rename from util/simple_memoizer_test.py
rename to compiler/util/simple_memoizer_test.py
index 50e3113..cfc35c7 100644
--- a/util/simple_memoizer_test.py
+++ b/compiler/util/simple_memoizer_test.py
@@ -15,7 +15,7 @@
 """Tests for simple_memoizer."""
 
 import unittest
-from util import simple_memoizer
+from compiler.util import simple_memoizer
 
 
 class SimpleMemoizerTest(unittest.TestCase):
diff --git a/util/traverse_ir.py b/compiler/util/traverse_ir.py
similarity index 99%
rename from util/traverse_ir.py
rename to compiler/util/traverse_ir.py
index 6e5b8a9..f0c10d0 100644
--- a/util/traverse_ir.py
+++ b/compiler/util/traverse_ir.py
@@ -16,7 +16,7 @@
 
 import inspect
 
-from public import ir_pb2
+from compiler.util import ir_pb2
 
 
 def _call_with_optional_args(function, positional_arg, keyword_args):
diff --git a/util/traverse_ir_test.py b/compiler/util/traverse_ir_test.py
similarity index 98%
rename from util/traverse_ir_test.py
rename to compiler/util/traverse_ir_test.py
index deb6dac..2e35a31 100644
--- a/util/traverse_ir_test.py
+++ b/compiler/util/traverse_ir_test.py
@@ -18,8 +18,8 @@
 
 import unittest
 
-from public import ir_pb2
-from util import traverse_ir
+from compiler.util import ir_pb2
+from compiler.util import traverse_ir
 
 _EXAMPLE_IR = ir_pb2.EmbossIr.from_json("""{
 "module": [
diff --git a/g3doc/BUILD b/doc/BUILD
similarity index 82%
rename from g3doc/BUILD
rename to doc/BUILD
index 3ee8e01..cf661bc 100644
--- a/g3doc/BUILD
+++ b/doc/BUILD
@@ -23,7 +23,6 @@
         "grammar.md",
         "__init__.py",
     ],
-    # This should only be needed by docs_are_up_to_date_test, but there is no
-    # way to specify a narrower visibility.
-    visibility = ["//front_end:__pkg__"],
+    # This should only be needed by docs_are_up_to_date_test.
+    visibility = ["//:__subpackages__"],
 )
diff --git a/g3doc/BogoNEL_BN-P-6000404_User_Guide.pdf b/doc/BogoNEL_BN-P-6000404_User_Guide.pdf
similarity index 100%
rename from g3doc/BogoNEL_BN-P-6000404_User_Guide.pdf
rename to doc/BogoNEL_BN-P-6000404_User_Guide.pdf
Binary files differ
diff --git a/g3doc/__init__.py b/doc/__init__.py
similarity index 100%
rename from g3doc/__init__.py
rename to doc/__init__.py
diff --git a/g3doc/cpp-guide.md b/doc/cpp-guide.md
similarity index 100%
rename from g3doc/cpp-guide.md
rename to doc/cpp-guide.md
diff --git a/g3doc/cpp-reference.md b/doc/cpp-reference.md
similarity index 100%
rename from g3doc/cpp-reference.md
rename to doc/cpp-reference.md
diff --git a/g3doc/design.md b/doc/design.md
similarity index 100%
rename from g3doc/design.md
rename to doc/design.md
diff --git a/g3doc/grammar.md b/doc/grammar.md
similarity index 100%
rename from g3doc/grammar.md
rename to doc/grammar.md
diff --git a/g3doc/guide.md b/doc/guide.md
similarity index 100%
rename from g3doc/guide.md
rename to doc/guide.md
diff --git a/g3doc/index.md b/doc/index.md
similarity index 100%
rename from g3doc/index.md
rename to doc/index.md
diff --git a/g3doc/language-reference.md b/doc/language-reference.md
similarity index 100%
rename from g3doc/language-reference.md
rename to doc/language-reference.md
diff --git a/g3doc/modular_congruence_multiplication_proof.md b/doc/modular_congruence_multiplication_proof.md
similarity index 100%
rename from g3doc/modular_congruence_multiplication_proof.md
rename to doc/modular_congruence_multiplication_proof.md
diff --git a/g3doc/roadmap.md b/doc/roadmap.md
similarity index 100%
rename from g3doc/roadmap.md
rename to doc/roadmap.md
diff --git a/g3doc/sitemap.md b/doc/sitemap.md
similarity index 100%
rename from g3doc/sitemap.md
rename to doc/sitemap.md
diff --git a/g3doc/text-format.md b/doc/text-format.md
similarity index 100%
rename from g3doc/text-format.md
rename to doc/text-format.md
diff --git a/g3doc/todo.md b/doc/todo.md
similarity index 100%
rename from g3doc/todo.md
rename to doc/todo.md
diff --git a/embossc b/embossc
index 9b1a69d..c32cd58 100755
--- a/embossc
+++ b/embossc
@@ -64,7 +64,7 @@
     subprocess_environment["PYTHONPATH"] = base_path
   front_end_args = [
       sys.executable,
-      path.join(base_path, "front_end", "emboss_front_end.py"),
+      path.join(base_path, "compiler", "front_end", "emboss_front_end.py"),
       "--output-ir-to-stdout",
       "--color-output", flags.color_output,
   ]
@@ -82,7 +82,8 @@
   back_end_status = subprocess.run(
       [
           sys.executable,
-          path.join(base_path, "back_end", "cpp", "emboss_codegen_cpp.py"),
+          path.join(base_path, "compiler", "back_end", "cpp",
+                    "emboss_codegen_cpp.py"),
       ],
       input=front_end_status.stdout,
       stdout=subprocess.PIPE,
diff --git a/integration/googletest/BUILD b/integration/googletest/BUILD
new file mode 100644
index 0000000..b52b103
--- /dev/null
+++ b/integration/googletest/BUILD
@@ -0,0 +1,38 @@
+# Copyright 2019 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+cc_library(
+    name = "emboss_test_util",
+    testonly = 1,
+    hdrs = ["emboss_test_util.h"],
+    visibility = ["//visibility:public"],
+    deps = [
+        "//runtime/cpp:cpp_utils",
+        "@com_google_googletest//:gtest",
+        "@com_google_absl//absl/memory",
+    ],
+)
+
+cc_test(
+    name = "emboss_test_util_test",
+    srcs = [
+        "emboss_test_util_test.cc",
+    ],
+    copts = ["-Wsign-compare"],
+    deps = [
+        ":emboss_test_util",
+        "@com_google_googletest//:gtest_main",
+        "//testdata:complex_structure_emboss",
+    ],
+)
diff --git a/public/emboss_test_util.h b/integration/googletest/emboss_test_util.h
similarity index 98%
rename from public/emboss_test_util.h
rename to integration/googletest/emboss_test_util.h
index 1919249..07cd2bb 100644
--- a/public/emboss_test_util.h
+++ b/integration/googletest/emboss_test_util.h
@@ -23,7 +23,7 @@
 #include "absl/memory/memory.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
-#include "public/emboss_text_util.h"
+#include "runtime/cpp/emboss_text_util.h"
 
 namespace emboss {
 
diff --git a/public/emboss_test_util_test.cc b/integration/googletest/emboss_test_util_test.cc
similarity index 98%
rename from public/emboss_test_util_test.cc
rename to integration/googletest/emboss_test_util_test.cc
index 4e886a6..bd39c3f 100644
--- a/public/emboss_test_util_test.cc
+++ b/integration/googletest/emboss_test_util_test.cc
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#include "public/emboss_test_util.h"
+#include "integration/googletest/emboss_test_util.h"
 
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
diff --git a/vim/ft-emboss/ftdetect/emboss.vim b/integration/vim/ft-emboss/ftdetect/emboss.vim
similarity index 100%
rename from vim/ft-emboss/ftdetect/emboss.vim
rename to integration/vim/ft-emboss/ftdetect/emboss.vim
diff --git a/vim/ft-emboss/ftplugin/emboss.vim b/integration/vim/ft-emboss/ftplugin/emboss.vim
similarity index 100%
rename from vim/ft-emboss/ftplugin/emboss.vim
rename to integration/vim/ft-emboss/ftplugin/emboss.vim
diff --git a/vim/ft-emboss/syntax/emboss.vim b/integration/vim/ft-emboss/syntax/emboss.vim
similarity index 100%
rename from vim/ft-emboss/syntax/emboss.vim
rename to integration/vim/ft-emboss/syntax/emboss.vim
diff --git a/runtime/cpp/BUILD b/runtime/cpp/BUILD
new file mode 100644
index 0000000..c547c88
--- /dev/null
+++ b/runtime/cpp/BUILD
@@ -0,0 +1,48 @@
+# Copyright 2019 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Emboss C++ Runtime.
+
+filegroup(
+    name = "raw_headers",
+    srcs = [
+        "emboss_arithmetic.h",
+        "emboss_array_view.h",
+        "emboss_bit_util.h",
+        "emboss_constant_view.h",
+        "emboss_cpp_types.h",
+        "emboss_cpp_util.h",
+        "emboss_defines.h",
+        "emboss_enum_view.h",
+        "emboss_maybe.h",
+        "emboss_memory_util.h",
+        "emboss_prelude.h",
+        "emboss_text_util.h",
+        "emboss_view_parameters.h",
+    ],
+    visibility = ["//:__subpackages__"],
+)
+
+cc_library(
+    name = "cpp_utils",
+    hdrs = [
+        ":raw_headers",
+    ],
+    visibility = ["//visibility:public"],
+    deps = [
+        # BEGIN INSERT_MY_SITE_DEFINES_TARGET_HERE
+        # "//MY_SITE_DEFINES:TARGET",
+        # END INSERT_MY_SITE_DEFINES_TARGET_HERE
+    ],
+)
diff --git a/public/emboss_arithmetic.h b/runtime/cpp/emboss_arithmetic.h
similarity index 98%
rename from public/emboss_arithmetic.h
rename to runtime/cpp/emboss_arithmetic.h
index bb73b7f..c84df17 100644
--- a/public/emboss_arithmetic.h
+++ b/runtime/cpp/emboss_arithmetic.h
@@ -20,8 +20,8 @@
 #include <cstdint>
 #include <type_traits>
 
-#include "public/emboss_bit_util.h"
-#include "public/emboss_maybe.h"
+#include "runtime/cpp/emboss_bit_util.h"
+#include "runtime/cpp/emboss_maybe.h"
 
 namespace emboss {
 namespace support {
diff --git a/public/emboss_array_view.h b/runtime/cpp/emboss_array_view.h
similarity index 98%
rename from public/emboss_array_view.h
rename to runtime/cpp/emboss_array_view.h
index 1f888a7..7cb19f9 100644
--- a/public/emboss_array_view.h
+++ b/runtime/cpp/emboss_array_view.h
@@ -21,9 +21,9 @@
 #include <tuple>
 #include <type_traits>
 
-#include "public/emboss_arithmetic.h"
-#include "public/emboss_array_view.h"
-#include "public/emboss_text_util.h"
+#include "runtime/cpp/emboss_arithmetic.h"
+#include "runtime/cpp/emboss_array_view.h"
+#include "runtime/cpp/emboss_text_util.h"
 
 namespace emboss {
 
diff --git a/public/emboss_bit_util.h b/runtime/cpp/emboss_bit_util.h
similarity index 98%
rename from public/emboss_bit_util.h
rename to runtime/cpp/emboss_bit_util.h
index 24ac132..db11c84 100644
--- a/public/emboss_bit_util.h
+++ b/runtime/cpp/emboss_bit_util.h
@@ -20,7 +20,7 @@
 #include <cstdint>
 #include <type_traits>
 
-#include "public/emboss_defines.h"
+#include "runtime/cpp/emboss_defines.h"
 
 namespace emboss {
 namespace support {
diff --git a/public/emboss_constant_view.h b/runtime/cpp/emboss_constant_view.h
similarity index 97%
rename from public/emboss_constant_view.h
rename to runtime/cpp/emboss_constant_view.h
index 41785e5..b867422 100644
--- a/public/emboss_constant_view.h
+++ b/runtime/cpp/emboss_constant_view.h
@@ -15,7 +15,7 @@
 #ifndef EMBOSS_PUBLIC_EMBOSS_CONSTANT_VIEW_H_
 #define EMBOSS_PUBLIC_EMBOSS_CONSTANT_VIEW_H_
 
-#include "public/emboss_maybe.h"
+#include "runtime/cpp/emboss_maybe.h"
 
 namespace emboss {
 namespace support {
diff --git a/public/emboss_cpp_types.h b/runtime/cpp/emboss_cpp_types.h
similarity index 100%
rename from public/emboss_cpp_types.h
rename to runtime/cpp/emboss_cpp_types.h
diff --git a/public/emboss_cpp_util.h b/runtime/cpp/emboss_cpp_util.h
similarity index 64%
rename from public/emboss_cpp_util.h
rename to runtime/cpp/emboss_cpp_util.h
index 624f931..e9fc5b8 100644
--- a/public/emboss_cpp_util.h
+++ b/runtime/cpp/emboss_cpp_util.h
@@ -17,15 +17,15 @@
 #ifndef EMBOSS_PUBLIC_EMBOSS_CPP_UTIL_H_
 #define EMBOSS_PUBLIC_EMBOSS_CPP_UTIL_H_
 
-#include "public/emboss_arithmetic.h"
-#include "public/emboss_array_view.h"
-#include "public/emboss_bit_util.h"
-#include "public/emboss_constant_view.h"
-#include "public/emboss_cpp_types.h"
-#include "public/emboss_defines.h"
-#include "public/emboss_enum_view.h"
-#include "public/emboss_memory_util.h"
-#include "public/emboss_text_util.h"
-#include "public/emboss_view_parameters.h"
+#include "runtime/cpp/emboss_arithmetic.h"
+#include "runtime/cpp/emboss_array_view.h"
+#include "runtime/cpp/emboss_bit_util.h"
+#include "runtime/cpp/emboss_constant_view.h"
+#include "runtime/cpp/emboss_cpp_types.h"
+#include "runtime/cpp/emboss_defines.h"
+#include "runtime/cpp/emboss_enum_view.h"
+#include "runtime/cpp/emboss_memory_util.h"
+#include "runtime/cpp/emboss_text_util.h"
+#include "runtime/cpp/emboss_view_parameters.h"
 
 #endif  // EMBOSS_PUBLIC_EMBOSS_CPP_UTIL_H_
diff --git a/public/emboss_defines.h b/runtime/cpp/emboss_defines.h
similarity index 100%
rename from public/emboss_defines.h
rename to runtime/cpp/emboss_defines.h
diff --git a/public/emboss_enum_view.h b/runtime/cpp/emboss_enum_view.h
similarity index 97%
rename from public/emboss_enum_view.h
rename to runtime/cpp/emboss_enum_view.h
index 6ed9453..8f739ce 100644
--- a/public/emboss_enum_view.h
+++ b/runtime/cpp/emboss_enum_view.h
@@ -21,8 +21,8 @@
 #include <string>
 #include <utility>
 
-#include "public/emboss_text_util.h"
-#include "public/emboss_view_parameters.h"
+#include "runtime/cpp/emboss_text_util.h"
+#include "runtime/cpp/emboss_view_parameters.h"
 
 namespace emboss {
 namespace support {
diff --git a/public/emboss_maybe.h b/runtime/cpp/emboss_maybe.h
similarity index 97%
rename from public/emboss_maybe.h
rename to runtime/cpp/emboss_maybe.h
index a11ba39..679b9ab 100644
--- a/public/emboss_maybe.h
+++ b/runtime/cpp/emboss_maybe.h
@@ -18,7 +18,7 @@
 
 #include <utility>
 
-#include "public/emboss_defines.h"
+#include "runtime/cpp/emboss_defines.h"
 
 namespace emboss {
 // TODO(bolms): Should Maybe be a public type (i.e., live in ::emboss)?
diff --git a/public/emboss_memory_util.h b/runtime/cpp/emboss_memory_util.h
similarity index 99%
rename from public/emboss_memory_util.h
rename to runtime/cpp/emboss_memory_util.h
index 00d6772..4d36140 100644
--- a/public/emboss_memory_util.h
+++ b/runtime/cpp/emboss_memory_util.h
@@ -20,9 +20,9 @@
 #include <cstddef>
 #include <cstring>
 
-#include "public/emboss_bit_util.h"
-#include "public/emboss_cpp_types.h"
-#include "public/emboss_defines.h"
+#include "runtime/cpp/emboss_bit_util.h"
+#include "runtime/cpp/emboss_cpp_types.h"
+#include "runtime/cpp/emboss_defines.h"
 
 namespace emboss {
 namespace support {
diff --git a/public/emboss_prelude.h b/runtime/cpp/emboss_prelude.h
similarity index 99%
rename from public/emboss_prelude.h
rename to runtime/cpp/emboss_prelude.h
index 85eeba8..04708a7 100644
--- a/public/emboss_prelude.h
+++ b/runtime/cpp/emboss_prelude.h
@@ -26,7 +26,7 @@
 #include <type_traits>
 #include <utility>
 
-#include "public/emboss_cpp_util.h"
+#include "runtime/cpp/emboss_cpp_util.h"
 
 // This namespace must match the [(cpp) namespace] in the Emboss prelude.
 namespace emboss {
diff --git a/public/emboss_text_util.h b/runtime/cpp/emboss_text_util.h
similarity index 99%
rename from public/emboss_text_util.h
rename to runtime/cpp/emboss_text_util.h
index 906f8c0..a4ab150 100644
--- a/public/emboss_text_util.h
+++ b/runtime/cpp/emboss_text_util.h
@@ -26,7 +26,7 @@
 #include <string>
 #include <vector>
 
-#include "public/emboss_defines.h"
+#include "runtime/cpp/emboss_defines.h"
 
 namespace emboss {
 
diff --git a/public/emboss_view_parameters.h b/runtime/cpp/emboss_view_parameters.h
similarity index 100%
rename from public/emboss_view_parameters.h
rename to runtime/cpp/emboss_view_parameters.h
diff --git a/public/BUILD b/runtime/cpp/test/BUILD
similarity index 67%
rename from public/BUILD
rename to runtime/cpp/test/BUILD
index dc08030..49928ea 100644
--- a/public/BUILD
+++ b/runtime/cpp/test/BUILD
@@ -19,45 +19,6 @@
     "emboss_cc_util_test",
 )
 
-py_library(
-    name = "ir_pb2",
-    srcs = ["ir_pb2.py"],
-    visibility = ["//:__subpackages__"],
-)
-
-filegroup(
-    name = "raw_headers",
-    srcs = [
-        "emboss_arithmetic.h",
-        "emboss_array_view.h",
-        "emboss_bit_util.h",
-        "emboss_constant_view.h",
-        "emboss_cpp_types.h",
-        "emboss_cpp_util.h",
-        "emboss_defines.h",
-        "emboss_enum_view.h",
-        "emboss_maybe.h",
-        "emboss_memory_util.h",
-        "emboss_prelude.h",
-        "emboss_text_util.h",
-        "emboss_view_parameters.h",
-    ],
-    visibility = ["//:__subpackages__"],
-)
-
-cc_library(
-    name = "cpp_utils",
-    hdrs = [
-        ":raw_headers",
-    ],
-    visibility = ["//visibility:public"],
-    deps = [
-        # BEGIN INSERT_MY_SITE_DEFINES_TARGET_HERE
-        # "//MY_SITE_DEFINES:TARGET",
-        # END INSERT_MY_SITE_DEFINES_TARGET_HERE
-    ],
-)
-
 emboss_cc_util_test(
     name = "emboss_prelude_test",
     srcs = [
@@ -65,7 +26,7 @@
     ],
     copts = ["-DEMBOSS_FORCE_ALL_CHECKS"],
     deps = [
-        ":cpp_utils",
+        "//runtime/cpp:cpp_utils",
         "@com_google_googletest//:gtest_main",
     ],
 )
@@ -77,7 +38,7 @@
     ],
     copts = ["-DEMBOSS_FORCE_ALL_CHECKS"],
     deps = [
-        ":cpp_utils",
+        "//runtime/cpp:cpp_utils",
         "@com_google_googletest//:gtest_main",
     ],
 )
@@ -89,7 +50,7 @@
     ],
     copts = ["-DEMBOSS_FORCE_ALL_CHECKS"],
     deps = [
-        ":cpp_utils",
+        "//runtime/cpp:cpp_utils",
         "@com_google_googletest//:gtest_main",
         "@com_google_absl//absl/strings:str_format",
     ],
@@ -102,7 +63,7 @@
     ],
     copts = ["-DEMBOSS_FORCE_ALL_CHECKS"],
     deps = [
-        ":cpp_utils",
+        "//runtime/cpp:cpp_utils",
         "@com_google_googletest//:gtest_main",
     ],
 )
@@ -114,7 +75,7 @@
     ],
     copts = ["-DEMBOSS_FORCE_ALL_CHECKS"],
     deps = [
-        ":cpp_utils",
+        "//runtime/cpp:cpp_utils",
         "@com_google_googletest//:gtest_main",
     ],
 )
@@ -126,7 +87,7 @@
     ],
     copts = ["-DEMBOSS_FORCE_ALL_CHECKS"],
     deps = [
-        ":cpp_utils",
+        "//runtime/cpp:cpp_utils",
         "@com_google_googletest//:gtest_main",
     ],
 )
@@ -138,7 +99,7 @@
     ],
     copts = ["-DEMBOSS_FORCE_ALL_CHECKS"],
     deps = [
-        ":cpp_utils",
+        "//runtime/cpp:cpp_utils",
         "@com_google_googletest//:gtest_main",
     ],
 )
@@ -150,7 +111,7 @@
     ],
     copts = ["-DEMBOSS_FORCE_ALL_CHECKS"],
     deps = [
-        ":cpp_utils",
+        "//runtime/cpp:cpp_utils",
         "@com_google_googletest//:gtest_main",
     ],
 )
@@ -162,7 +123,7 @@
     ],
     copts = ["-DEMBOSS_FORCE_ALL_CHECKS"],
     deps = [
-        ":cpp_utils",
+        "//runtime/cpp:cpp_utils",
         "@com_google_googletest//:gtest_main",
     ],
 )
@@ -174,7 +135,7 @@
     ],
     copts = ["-DEMBOSS_FORCE_ALL_CHECKS"],
     deps = [
-        ":cpp_utils",
+        "//runtime/cpp:cpp_utils",
         "@com_google_googletest//:gtest_main",
     ],
 )
@@ -186,7 +147,7 @@
     ],
     copts = ["-DEMBOSS_FORCE_ALL_CHECKS"],
     deps = [
-        ":cpp_utils",
+        "//runtime/cpp:cpp_utils",
         "@com_google_googletest//:gtest_main",
     ],
 )
@@ -201,33 +162,8 @@
         "-Wsign-compare",
     ],
     deps = [
-        ":cpp_utils",
+        "//runtime/cpp:cpp_utils",
         "@com_google_absl//absl/strings",
         "@com_google_googletest//:gtest_main",
     ],
 )
-
-cc_library(
-    name = "emboss_test_util",
-    testonly = 1,
-    hdrs = ["emboss_test_util.h"],
-    visibility = ["//visibility:public"],
-    deps = [
-        ":cpp_utils",
-        "@com_google_googletest//:gtest",
-        "@com_google_absl//absl/memory",
-    ],
-)
-
-cc_test(
-    name = "emboss_test_util_test",
-    srcs = [
-        "emboss_test_util_test.cc",
-    ],
-    copts = ["-Wsign-compare"],
-    deps = [
-        ":emboss_test_util",
-        "@com_google_googletest//:gtest_main",
-        "//testdata:complex_structure_emboss",
-    ],
-)
diff --git a/runtime/cpp/test/build_defs.bzl b/runtime/cpp/test/build_defs.bzl
new file mode 100644
index 0000000..c32759d
--- /dev/null
+++ b/runtime/cpp/test/build_defs.bzl
@@ -0,0 +1,34 @@
+# Copyright 2019 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# -*- mode: python; -*-
+# vim:set ft=blazebuild:
+
+def emboss_cc_util_test(name, copts = [], **kwargs):
+    """Constructs two cc_test targets, with and without optimizations."""
+    native.cc_test(
+        name = name,
+        copts = copts + ["-Wsign-compare"],
+        **kwargs
+    )
+    native.cc_test(
+        name = name + "_no_opts",
+        copts = copts + [
+            # This is generally a dangerous flag for an individual target, but
+            # these tests do not depend on any other .cc files that might
+            # #include any Emboss headers.
+            "-DEMBOSS_NO_OPTIMIZATIONS",
+        ],
+        **kwargs
+    )
diff --git a/public/emboss_arithmetic_test.cc b/runtime/cpp/test/emboss_arithmetic_test.cc
similarity index 99%
rename from public/emboss_arithmetic_test.cc
rename to runtime/cpp/test/emboss_arithmetic_test.cc
index 42ccd6d..62c8f3b 100644
--- a/public/emboss_arithmetic_test.cc
+++ b/runtime/cpp/test/emboss_arithmetic_test.cc
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#include "public/emboss_arithmetic.h"
+#include "runtime/cpp/emboss_arithmetic.h"
 
 #include "gtest/gtest.h"
 
diff --git a/public/emboss_array_view_test.cc b/runtime/cpp/test/emboss_array_view_test.cc
similarity index 98%
rename from public/emboss_array_view_test.cc
rename to runtime/cpp/test/emboss_array_view_test.cc
index aa9fde2..bec26bc 100644
--- a/public/emboss_array_view_test.cc
+++ b/runtime/cpp/test/emboss_array_view_test.cc
@@ -12,14 +12,14 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#include "public/emboss_array_view.h"
+#include "runtime/cpp/emboss_array_view.h"
 
 #include <string>
 #include <type_traits>
 
 #include "absl/strings/str_format.h"
 #include "gtest/gtest.h"
-#include "public/emboss_prelude.h"
+#include "runtime/cpp/emboss_prelude.h"
 
 namespace emboss {
 namespace support {
diff --git a/public/emboss_bit_util_test.cc b/runtime/cpp/test/emboss_bit_util_test.cc
similarity index 98%
rename from public/emboss_bit_util_test.cc
rename to runtime/cpp/test/emboss_bit_util_test.cc
index 28fa1c8..52bff49 100644
--- a/public/emboss_bit_util_test.cc
+++ b/runtime/cpp/test/emboss_bit_util_test.cc
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#include "public/emboss_bit_util.h"
+#include "runtime/cpp/emboss_bit_util.h"
 
 #include "gtest/gtest.h"
 
diff --git a/public/emboss_constant_view_test.cc b/runtime/cpp/test/emboss_constant_view_test.cc
similarity index 97%
rename from public/emboss_constant_view_test.cc
rename to runtime/cpp/test/emboss_constant_view_test.cc
index 1f49466..e5484b9 100644
--- a/public/emboss_constant_view_test.cc
+++ b/runtime/cpp/test/emboss_constant_view_test.cc
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#include "public/emboss_constant_view.h"
+#include "runtime/cpp/emboss_constant_view.h"
 
 #include "gtest/gtest.h"
 
diff --git a/public/emboss_cpp_types_test.cc b/runtime/cpp/test/emboss_cpp_types_test.cc
similarity index 98%
rename from public/emboss_cpp_types_test.cc
rename to runtime/cpp/test/emboss_cpp_types_test.cc
index d71a2df..6a71d73 100644
--- a/public/emboss_cpp_types_test.cc
+++ b/runtime/cpp/test/emboss_cpp_types_test.cc
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#include "public/emboss_cpp_types.h"
+#include "runtime/cpp/emboss_cpp_types.h"
 
 #include "gtest/gtest.h"
 
diff --git a/public/emboss_cpp_util_google_integration_test.cc b/runtime/cpp/test/emboss_cpp_util_google_integration_test.cc
similarity index 95%
rename from public/emboss_cpp_util_google_integration_test.cc
rename to runtime/cpp/test/emboss_cpp_util_google_integration_test.cc
index 7592a1a..55a1daf 100644
--- a/public/emboss_cpp_util_google_integration_test.cc
+++ b/runtime/cpp/test/emboss_cpp_util_google_integration_test.cc
@@ -14,7 +14,7 @@
 
 #include "absl/strings/string_view.h"
 #include "gtest/gtest.h"
-#include "public/emboss_cpp_util.h"
+#include "runtime/cpp/emboss_cpp_util.h"
 
 namespace emboss {
 namespace support {
diff --git a/public/emboss_defines_test.cc b/runtime/cpp/test/emboss_defines_test.cc
similarity index 97%
rename from public/emboss_defines_test.cc
rename to runtime/cpp/test/emboss_defines_test.cc
index 1cf0779..9efc2da 100644
--- a/public/emboss_defines_test.cc
+++ b/runtime/cpp/test/emboss_defines_test.cc
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#include "public/emboss_defines.h"
+#include "runtime/cpp/emboss_defines.h"
 
 #include <cstdint>
 
diff --git a/public/emboss_enum_view_test.cc b/runtime/cpp/test/emboss_enum_view_test.cc
similarity index 98%
rename from public/emboss_enum_view_test.cc
rename to runtime/cpp/test/emboss_enum_view_test.cc
index 6723e07..9fde28f 100644
--- a/public/emboss_enum_view_test.cc
+++ b/runtime/cpp/test/emboss_enum_view_test.cc
@@ -12,10 +12,10 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#include "public/emboss_enum_view.h"
+#include "runtime/cpp/emboss_enum_view.h"
 
 #include "gtest/gtest.h"
-#include "public/emboss_prelude.h"
+#include "runtime/cpp/emboss_prelude.h"
 
 namespace emboss {
 namespace support {
diff --git a/public/emboss_maybe_test.cc b/runtime/cpp/test/emboss_maybe_test.cc
similarity index 97%
rename from public/emboss_maybe_test.cc
rename to runtime/cpp/test/emboss_maybe_test.cc
index 1373617..2c8a691 100644
--- a/public/emboss_maybe_test.cc
+++ b/runtime/cpp/test/emboss_maybe_test.cc
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#include "public/emboss_maybe.h"
+#include "runtime/cpp/emboss_maybe.h"
 
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
diff --git a/public/emboss_memory_util_test.cc b/runtime/cpp/test/emboss_memory_util_test.cc
similarity index 99%
rename from public/emboss_memory_util_test.cc
rename to runtime/cpp/test/emboss_memory_util_test.cc
index 074e0e1..5460347 100644
--- a/public/emboss_memory_util_test.cc
+++ b/runtime/cpp/test/emboss_memory_util_test.cc
@@ -12,10 +12,10 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#include "public/emboss_memory_util.h"
+#include "runtime/cpp/emboss_memory_util.h"
 
 #include "gtest/gtest.h"
-#include "public/emboss_prelude.h"
+#include "runtime/cpp/emboss_prelude.h"
 
 namespace emboss {
 namespace support {
diff --git a/public/emboss_prelude_test.cc b/runtime/cpp/test/emboss_prelude_test.cc
similarity index 99%
rename from public/emboss_prelude_test.cc
rename to runtime/cpp/test/emboss_prelude_test.cc
index 599519a..ed8d516 100644
--- a/public/emboss_prelude_test.cc
+++ b/runtime/cpp/test/emboss_prelude_test.cc
@@ -12,12 +12,12 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#include "public/emboss_prelude.h"
+#include "runtime/cpp/emboss_prelude.h"
 
 #include <type_traits>
 
 #include "gtest/gtest.h"
-#include "public/emboss_cpp_util.h"
+#include "runtime/cpp/emboss_cpp_util.h"
 
 namespace emboss {
 namespace prelude {
diff --git a/public/emboss_text_util_test.cc b/runtime/cpp/test/emboss_text_util_test.cc
similarity index 99%
rename from public/emboss_text_util_test.cc
rename to runtime/cpp/test/emboss_text_util_test.cc
index 742bcae..b7af4b8 100644
--- a/public/emboss_text_util_test.cc
+++ b/runtime/cpp/test/emboss_text_util_test.cc
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#include "public/emboss_text_util.h"
+#include "runtime/cpp/emboss_text_util.h"
 
 #include <cmath>
 #include <limits>
diff --git a/testdata/BUILD b/testdata/BUILD
index 5df3b38..d757da7 100644
--- a/testdata/BUILD
+++ b/testdata/BUILD
@@ -14,7 +14,7 @@
 
 # Shared test data for Emboss.
 
-load("//public:build_defs.bzl", "emboss_cc_library")
+load("//:build_defs.bzl", "emboss_cc_library")
 
 package(
     default_visibility = ["//:__subpackages__"],