Website Summary Files Commits Branches @commit @diff @stats
path: root / homework / 81030 / 1,2-rust2html / README.md
diff options
context:
space:
mode:
1 files changed, 50 insertions, 0 deletions
-rw-r--r--homework/81030/1,2-rust2html/README.md50
diff --git a/homework/81030/1,2-rust2html/README.md b/homework/81030/1,2-rust2html/README.md
new file mode 100644
index 0000000..577a3d0
--- /dev/null
+++ b/homework/81030/1,2-rust2html/README.md
@@ -0,0 +1,50 @@
+# Rust syntax highlighter
+
+This is an implementation of a syntax highlighter for the Rust programming language. It takes a Rust program as input (or a Rust source file as an argument) and outputs a HTML page with a colorized version of the program. The C source for the highlighter is generated from a Flex-based scanner template (`rust2html.l`). (This is a solution to the first homework assignment.)
+
+There is also an extended and improved version of the highlighter which implements pretty-printing (`rust2html-prettyprint.l`). (This is a solution to the second homework assignment.)
+
+## Generating and building
+
+On Unix-like OS:
+
+* the regular highlighter:
+
+ flex rust2html.l
+ cc -o rust2html lex.yy.c
+
+* the extended (pretty-printing) highlighter:
+
+ flex rust2html-prettyprint.l
+ cc -o rust2html-prettyprint lex.yy.c
+
+Using the provided `Makefile`:
+
+* the regular highlighter:
+
+ make rust2html
+
+* the extended (pretty-printing) highlighter:
+
+ make rust2html-prettyprint
+
+## Usage
+
+This will generate a HTML document named `example.html` with a colorized version of the `example.rs` Rust program:
+
+ ./rust2html example.rs > example.html
+
+This will generate a HTML document named `example.html` with a colorized and pretty-printed version of the `example.rs` Rust program:
+
+ ./rust2html-prettyprint example.rs > example.html
+
+## Debugging
+
+If you want to be able to debug the `RUST2HTML` scanner (i.e. `rust2html` or `rust2html-prettyprint`), generate its code using the `-d` flag with Flex:
+
+ flex -d RUST2HTML.l
+ cc -o RUST2HTML lex.yy.c
+
+The following invocation of `RUST2HTML` will also write its standard error output to the `example.log` file (which is the main thing to look at when trying to debug the program):
+
+ ./RUST2HTML example.rs > example.html 2> example.log \ No newline at end of file