diff options
author | Matthew Sotoudeh <matthew@masot.net> | 2024-03-22 23:18:12 -0400 |
---|---|---|
committer | Matthew Sotoudeh <matthew@masot.net> | 2024-03-22 23:18:12 -0400 |
commit | 2eb02647da66f914e7f99064f13c1ed89ae24232 (patch) | |
tree | 6cabf3ba3048d7c594504dc99df87bc0ce430953 | |
parent | d0525b7980d89735e050688fe759eb1307236e3b (diff) |
move python code to subdir
-rw-r--r-- | README.md | 76 | ||||
-rw-r--r-- | py_version/gamma/Makefile (renamed from gamma/Makefile) | 0 | ||||
-rw-r--r-- | py_version/gamma/__init__.py (renamed from gamma/__init__.py) | 0 | ||||
-rw-r--r-- | py_version/gamma/instantiator.py (renamed from gamma/instantiator.py) | 0 | ||||
-rw-r--r-- | py_version/gamma/lexer.l (renamed from gamma/lexer.l) | 0 | ||||
-rw-r--r-- | py_version/gamma/lexer.py (renamed from gamma/lexer.py) | 0 | ||||
-rw-r--r-- | py_version/gamma/mangler.py (renamed from gamma/mangler.py) | 0 | ||||
-rw-r--r-- | py_version/gamma/parser.py (renamed from gamma/parser.py) | 0 | ||||
-rw-r--r-- | py_version/gamma/splitter.py (renamed from gamma/splitter.py) | 0 | ||||
-rwxr-xr-x | py_version/gc (renamed from gc) | 0 |
10 files changed, 0 insertions, 76 deletions
diff --git a/README.md b/README.md deleted file mode 100644 index 28f26f1..0000000 --- a/README.md +++ /dev/null @@ -1,76 +0,0 @@ -# User Instructions - -First, build the lexer: - - $ make -C gamma - -Then, in your makefile: - - CC=/path/to/gc gcc - LD=/path/to/gc gcc - -(any C compiler supporting the -E option can be used in place of 'gcc' above) - -# Known issues - -Searching for header files may not work properly. - -Paths with spaces will die - -Currently, the only input formats recognized are: .c, .o, and .a. We plan to -support .so. - -If you declare a local/global array variable with the same name as a generic, -it will be interpreted and instantiated as that generic. This behavior is -similar to naming a function or variable the same thing as a preprocessor -macro. - - To help with this, Gamma will lex `ident.` as a single identifier. This - means you can use `ident.[int]` and `ident.[type T]` to place your - templates in a separate namespace from normal C identifiers. - -Line info will get completely butchered - -Your builds will slow down. There are currently two sources of this: (1) we -serialize everything, and (2) the time it takes to actually -preprocess/instantiate templates/etc. We have plans to fix the former, but the -latter is a bit more unavoidable until we self-host in gamma. - - As an initial help, if a file does not contain any template definitions, - declarations, or uses, it gets exempted from further processing (i.e., an - actual .o is made). On the sbase repository, our build slowdown with this - optimization is about 4x. - -If the .c file uses templates, then the .o files produced by `gc` will not -proper ELF files, so you shouldn't try to objdump them/etc. - -# Gamma design - -## PARSER -The PARSER is an internal method that takes a C file and identifies the -following: - - 1. All the template definitions - 2. All the template instantiations - -Instantiations can be nested within a definition. - -'Definitions' includes declarations; basically anything defined or declared at -the global scope - -CURRENTLY, the parser rules are: - - 1. Anything at the top scope that sees a "] (" or "] {" before any other - open brace is considered a template definition - 2. Anything of the form "X [ ... ]" where "X" is an earlier-defined - (declared) template is considered a use (call) - -## INSTANTIATOR: -- Parse a file, splitting into 'calls' and 'rules' -- Solve for the concrete instantiations (calls) needed -- Rewrite the file, replacing each template definition with all of its concrete - instantiations - -## MANGLER -Given a file, parses and it replaces every template use "X [ A, B, ...]" with -"X_A_B_..." diff --git a/gamma/Makefile b/py_version/gamma/Makefile index 9e09399..9e09399 100644 --- a/gamma/Makefile +++ b/py_version/gamma/Makefile diff --git a/gamma/__init__.py b/py_version/gamma/__init__.py index 48f551c..48f551c 100644 --- a/gamma/__init__.py +++ b/py_version/gamma/__init__.py diff --git a/gamma/instantiator.py b/py_version/gamma/instantiator.py index f278491..f278491 100644 --- a/gamma/instantiator.py +++ b/py_version/gamma/instantiator.py diff --git a/gamma/lexer.l b/py_version/gamma/lexer.l index 623000a..623000a 100644 --- a/gamma/lexer.l +++ b/py_version/gamma/lexer.l diff --git a/gamma/lexer.py b/py_version/gamma/lexer.py index 35f6ed5..35f6ed5 100644 --- a/gamma/lexer.py +++ b/py_version/gamma/lexer.py diff --git a/gamma/mangler.py b/py_version/gamma/mangler.py index 26e21ce..26e21ce 100644 --- a/gamma/mangler.py +++ b/py_version/gamma/mangler.py diff --git a/gamma/parser.py b/py_version/gamma/parser.py index 13b1bc8..13b1bc8 100644 --- a/gamma/parser.py +++ b/py_version/gamma/parser.py diff --git a/gamma/splitter.py b/py_version/gamma/splitter.py index 23f2518..23f2518 100644 --- a/gamma/splitter.py +++ b/py_version/gamma/splitter.py |