An implementation of the SubC language in Go
License
qeedquan/gosubc
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
master
Could not load branches
Nothing to show
Could not load tags
Nothing to show
{{ refName }}
default
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code
-
Clone
Use Git or checkout with SVN using the web URL.
Work fast with our official CLI. Learn more.
- Open with GitHub Desktop
- Download ZIP
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
SubC is a simple subset of C originally written by Nils Holms (http://www.t3x.org/) for teaching newcomers how to write a compiler. This is a reimplementation of SubC based on Nils compiler (subc-20161212.tgz) and the Go standard packages in Go. The code generation is based on the SubC compiler while the lexer, parser, and type checker is based on the Go standard library packages. The code emitted by this compiler should match exactly with what SubC generates. The linux amd64/i386 code generator has been tested, but the Makefile only supports linux amd64 right now. The darwinamd64 and arm6 has not been tested and was just implemented by a transliteration. There are some minor differences in this implementation of SubC and the official one. The differences are listed below: * __FILE__, __LINE__, __TIME__, __DATE__, __func__, __FUNCTION__, __COUNTER__ are supported * #warning, multi-line macros are supported * goto is supported, labels can be declared after local variable declarations. * function parameters can have no names, ie, void f(int, int a, int, char x) * more lenient on assignments; we can assign integers to pointers after local declarations and integer types can be assigned by pointer types. The bugs/ directory has all the known bugs. The subc/ dir contains the original subc code for bootstrapping The src/ dir contains the Go source code of the compiler The test/ dir is for test code to make sure that we generate exact same code as subc
About
An implementation of the SubC language in Go
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published