sjolsen / compiler Goto Github PK
View Code? Open in Web Editor NEWCompiler for CS4318
Compiler for CS4318
The project directory is structured as follows: ./bin Compiled executables ./build Temporary directory for object files and the like ./include Headers ./lib Object archives for easier dependency management and library modularity ./src Library source code ./test Contains test input files and scripts for testing component-drivers against those files The available make targets are: all Builds all library and driver binaries clean Removes binary and object files mcc Builds the main executable text_processing Builds the text processing library tokenizer Builds the tokenization library (depends on the text processing library) ast Builds the abstract syntax tree library testall Runs all available top-level tests test-scanner Runs the test script for the scanner test-parser Runs the test script for the parser test-semantic Runs the test script for the semantic analyser Additional arguments may be passed to the compiler by setting the CXXFLAGS environment variable. The main executable takes as its first argument the name of the file to be compiled; '-' may be given as the first argument to indicate that input should be read from STDIN. Additionally, '-Tscanner' may be passed as the second argument to print output from the scanner stage, terminating before the parsing stage. The grammar matched by this program is slightly modified, allowing lists to be represented as true lists, rather than recursively along the tree. The grammar also adds support for declaring undefined functions for linking against C, as well as the '...' notation for variable arguments This grammar is specified in the file 'GRAMMAR'. The parser does do minimal semantic checking, as it constructs the symbol tables during parsing. Passing the '-Tparser' argument causes the program to output the syntax tree as a tree of nested s-expressions of the form: (production-rule &rest components) The semantic analysis component of the program, which may be tested by passing the '-Tsemantic' argument, performs the following checks: - Type checking in assignments - Conditional expressions of type 'void' - Return types (including 'return;' in non-void functions) - Undefined variables and functions - Multiple declarations of variables and functions (defining a forward-declared function is a multiple declaration) - Array bounds access (single-factor literals only; 'int' and 'char' literals both allowed) - Array subscript type checking - Arithmetic comparison of non-integral types - General type promotion from 'char' to 'int' - Function argument checking: both number and type (no type promotion) The code generator performs constant folding. Recursion is supported, Global variables, arrays, and functions with more than four arguments are as of yet only partially implemented. Both int and char datatypes are supported, as are all relational operators. Variable arguments are supported in function declarations, but no facility is provided to access the extra arguments. Using the GNU toolchain, the assembly produced by the compiler may be linked with C, provided the appropriate forward declarations are made. The following function is predeclared in the compiler source, and implemented in C: int output (int n); It prints the provided integer to stdout, followed by a newline. To use this function, code must be linked against output.o in bin/lib. The compiler outputs generated assembly to stdout. This assembly is compatible, and intended to be used, with GCC on Linux-MIPS. The code generated by the compiler is PIC-safe. Testing may be performed through make, or 'test/[component]/run_tests.bash' may be invoked directly The test script may be run in verbose mode (via -v), displaying the component's output as normal. Building this project requires a mostly C++11-compliant compiler and standard library. At this point, no third-party libraries are in use. The project compiles successfully under GCC/libstdc++ 4.6.3, accessible at athena.cs.txstate.edu. The source tree is described in 'ABOUT'.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.