Skip to content

Commit

Permalink
rename compiler/ to gypsum/; vm/ to codeswitch/
Browse files Browse the repository at this point in the history
Remove remaining copyright notices
  • Loading branch information
jayconrod committed Jan 22, 2017
1 parent 5a364ab commit c0e9635
Show file tree
Hide file tree
Showing 211 changed files with 147 additions and 140 deletions.
9 changes: 5 additions & 4 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
Copyright 2014-2017, Jay Conrod. All rights reserved.

The Gypsum bootstrap compiler in the `compiler` directory is licensed
The Gypsum bootstrap compiler in the `gypsum` directory is licensed
under the GNU General Public License v3, which can be found in
compiler/LICENSE.txt.
gypsum/LICENSE.txt.

The CodeSwitch virtual machine in the `vm` directory is licensed under
a 3-clause BSD license, which can be found in vm/LICENSE.txt.
The CodeSwitch virtual machine in the `codeswitch` directory is
licensed under a 3-clause BSD license, which can be found in
codeswitch/LICENSE.txt.

gypsum-mode.el is licensed under a 3-clause BSD license, which can be
found in tools/gypsum-mode.el itself.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

# Copyright 2014 Jay Conrod. All rights reserved.
# Copyright Jay Conrod. All rights reserved.

# This file is part of CodeSwitch. Use of this source code is governed by
# the 3-clause BSD license that can be found in the LICENSE.txt file.
Expand Down
2 changes: 1 addition & 1 deletion vm/src/gen_flags_h.py → codeswitch/src/gen_flags_h.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

# Copyright 2014-2015 Jay Conrod. All rights reserved.
# Copyright Jay Conrod. All rights reserved.

# This file is part of CodeSwitch. Use of this source code is governed by
# the 3-clause BSD license that can be found in the LICENSE.txt file.
Expand Down
2 changes: 1 addition & 1 deletion vm/src/gen_opcodes.py → codeswitch/src/gen_opcodes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

# Copyright 2014 Jay Conrod. All rights reserved.
# Copyright Jay Conrod. All rights reserved.

# This file is part of CodeSwitch. Use of this source code is governed by
# the 3-clause BSD license that can be found in the LICENSE.txt file.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016 Jay Conrod. All rights reserved.
# Copyright Jay Conrod. All rights reserved.

# This file is part of CodeSwitch. Use of this source code is governed by
# the 3-clause BSD license that can be found in the LICENSE.txt file.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016 Jay Conrod. All rights reserved.
# Copyright Jay Conrod. All rights reserved.

# This file is part of CodeSwitch. Use of this source code is governed by
# the 3-clause BSD license that can be found in the LICENSE.txt file.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion vm/test/mktest.py → codeswitch/test/mktest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

# Copyright 2014-2016 Jay Conrod. All rights reserved.
# Copyright Jay Conrod. All rights reserved.

# This file is part of CodeSwitch. Use of this source code is governed by
# the 3-clause BSD license that can be found in the LICENSE.txt file.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
129 changes: 0 additions & 129 deletions compiler/driver.py

This file was deleted.

File renamed without changes.
File renamed without changes.
135 changes: 135 additions & 0 deletions gypsum/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Copyright Jay Conrod. All rights reserved.
#
# This file is part of Gypsum. Use of this source code is governed by
# the GPL license that can be found in the LICENSE.txt file.


import argparse
import os
import os.path
import re
import sys

import ast
from compile_info import CompileInfo, STD_NAME
from compiler import compile
from errors import CompileException
from externalization import externalize
from ids import AstId, TARGET_PACKAGE_ID
from inheritance_analysis import analyzeInheritance
from ir import Package, PackageVersion, PackageDependency, Name
from layout import layout
from lexer import *
from location import NoLoc
from package_loader import PackageLoader
from parser import *
from scope_analysis import *
from serialize import serialize
from tok import NEWLINE, SPACE, COMMENT
from type_analysis import analyzeTypeDeclarations, analyzeTypes


def main():
sys.setrecursionlimit(10000)

PackageName = lambda s: Name.fromString(s, isPackageName=True)
cmdline = argparse.ArgumentParser(description="Compile source files into CodeSwitch packages")
cmdline.add_argument("sources", metavar="source", type=str, nargs="+",
help="Source file names")
cmdline.add_argument("-p", "--package-name", action="store", type=PackageName,
default=PackageName("default"),
help="Name of the package being compiled")
cmdline.add_argument("-v", "--package-version", action="store", type=PackageVersion.fromString,
default=PackageVersion([0]),
help="Version of the package being compiled")
cmdline.add_argument("-d", "--depends", action="append", type=PackageDependency.fromString,
default=[],
help="Additional package dependencies")
cmdline.add_argument("--no-std", action="store_true",
help="Do not add a dependency on the standard library")
cmdline.add_argument("-P", "--package-path", action="append", type=str, default=[],
help="Directories containing packages that could be imported")
cmdline.add_argument("-o", "--output", action="store",
default="out.csp",
help="Name of the output file")
cmdline.add_argument("--print-tokens", action="store_true",
help="Print raw tokens after lexical analysis")
cmdline.add_argument("--no-layout", action="store_true",
help="Disable layout analysis")
cmdline.add_argument("--print-layout", action="store_true",
help="Print layout tokens after layout analysis")
cmdline.add_argument("--print-ast", action="store_true",
help="Print abstract syntax tree after syntax analysis")
cmdline.add_argument("--print-scope", action="store_true",
help="Print scope info after scope analysis")
cmdline.add_argument("--print-types", action="store_true",
help="Print types after type analysis")
cmdline.add_argument("--print-ir", action="store_true",
help="Print intermediate representation after compilation")
cmdline.add_argument("--print-stack", action="store_true",
help="Print compiler stack on error")
args = cmdline.parse_args()

loader = PackageLoader(args.package_path if len(args.package_path) > 0 else None)

try:
astModules = []
for sourceFileName in args.sources:
with open(sourceFileName) as inFile:
source = inFile.read()
rawTokens = lex(sourceFileName, source)
if args.print_tokens:
for tok in rawTokens:
sys.stdout.write(str(tok) + "\n")
if args.no_layout:
layoutTokens = filter(lambda tok: tok.tag not in [NEWLINE, SPACE, COMMENT], rawTokens)
else:
layoutTokens = layout(rawTokens)
if args.print_layout:
for tok in layoutTokens:
sys.stdout.write(str(tok) + "\n")
astModule = parse(sourceFileName, layoutTokens)
if args.print_ast:
printer = ast.Printer(sys.stdout)
printer.visit(astModule)
astModules.append(astModule)
astPackage = ast.Package(astModules, NoLoc)
astPackage.id = AstId(-1)

package = Package(TARGET_PACKAGE_ID, args.package_name, args.package_version)
package.dependencies.extend(args.depends)
isUsingStd = not args.no_std
if isUsingStd:
stdPackage = loader.loadPackage(STD_NAME, NoLoc)
package.ensureDependency(stdPackage)
info = CompileInfo(astPackage, package, loader, isUsingStd=isUsingStd)

analyzeDeclarations(info)
if args.print_scope:
sys.stderr.write("--print-scope not supported right now\n")
analyzeTypeDeclarations(info)
analyzeInheritance(info)
analyzeTypes(info)
if args.print_types:
sys.stderr.write("--print-types not supported right now\n")
convertClosures(info)
externalize(info)
compile(info)

package = info.package
if args.print_ir:
sys.stdout.write("%s\n" % str(package))
serialize(package, args.output)

except (CompileException, IOError) as err:
if args.print_stack:
raise
if isinstance(err, CompileException):
sys.stderr.write("%s\n" % str(err))
else:
sys.stderr.write("%s: error: %s\n" % (sourceFileName, str(err)))
sys.exit(1)


if __name__ == "__main__":
main()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion compiler/run-tests → gypsum/run-tests
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python2.7
# -*- mode: python; -*-

# Copyright 2015, Jay Conrod. All rights reserved.
# Copyright Jay Conrod. All rights reserved.
#
# This file is part of Gypsum. Use of this source code is governed by
# the GPL license that can be found in the LICENSE.txt file.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit c0e9635

Please sign in to comment.