cs143-compilers's Introduction
README file for Programming Assignment 1 ===================================================== Your directory should now contain the following files: Makefile -> [course dir]/src/PA1/Makefile README cool.flex test.cl lextest.cc -> [course dir]/src/PA1/lextest.cc mycoolc -> [course dir]/src/PA1/mycoolc stringtab.cc -> [course dir]/src/PA1/stringtab.cc utilities.cc -> [course dir]/src/PA1/utilities.cc handle_flags.cc -> [course dir]/src/PA1/handle_flags.cc *.d dependency files *.* other generated files The include (.h) files for this assignment can be found in [course dir]/include/PA1 The Makefile contains targets for compiling and running your program. DO NOT MODIFY. The README contains this info. Edit this file to include your SUNet ID(s). Refer to the assignment handout for details. cool.flex is a skeleton file for the specification of the lexical analyzer. You should complete it with your regular expressions, patterns and actions. test.cl is a COOL program that you can test the lexical analyzer on. It contains some errors, so it won't compile with coolc. However, test.cl does not exercise all lexical constructs of COOL and part of your assignment is to rewrite test.cl with a complete set of tests for your lexical analyzer. cool-parse.h contains definitions that are used by almost all parts of the compiler. DO NOT MODIFY. stringtab.{cc|h} and stringtab_functions.h contains functions to manipulate the string tables. DO NOT MODIFY. utilities.{cc|h} contains functions used by the main() part of the lextest program. You may want to use the strdup() function defined in here. Remember that you should not print anything from inside cool.flex! DO NOT MODIFY. lextest.cc contains the main function which will call your lexer and print out the tokens that it returns. DO NOT MODIFY. mycoolc is a shell script that glues together the phases of the compiler using Unix pipes instead of statically linking code. While inefficient, this architecture makes it easy to mix and match the components you write with those of the course compiler. DO NOT MODIFY. cool-lexer.cc is the scanner generated by flex from cool.flex. DO NOT MODIFY IT, as your changes will be overwritten the next time you run flex. The *.d files are automatically generated Makefiles that capture dependencies between source and header files in this directory. These files are updated automatically by Makefile; see the gmake documentation for a detailed explanation. Instructions ------------ To compile your lextest program type: % make lexer Run your lexer by putting your test input in a file 'foo.cl' and run the lextest program: % ./lexer foo.cl To run your lexer on the file test.cl type: % make dotest If you think your lexical analyzer is correct and behaves like the one we wrote, you can actually try 'mycoolc' and see whether it runs and produces correct code for any examples. If your lexical analyzer behaves in an unexpected manner, you may get errors anywhere, i.e. during parsing, during semantic analysis, during code generation or only when you run the produced code on spim. So beware. To turn in your work type: % make submit Running "submit" will collect the files cool.flex, test.cl, README, and test.output. Don't forget to edit the README file to include your SUNet ID(s), and to write your own test cases in test.cl. You may turn in the assignment as many times as you like. However, only the last version will be retained for grading. If you change architectures you must issue % make clean when you switch from one type of machine to the other. If at some point you get weird errors from the linker, you probably forgot this step. GOOD LUCK!
cs143-compilers's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.