Website Summary Files Commits Branches @commit @diff @stats
path: root / homework / 81030 / 1,2-rust2html / README.md
diff options
context:
space:
mode:
Commit5729bc0ea96fc0b944c243230910c537d692bcad (patch)
Author
 Radoslav Georgiev <rgeorgiev583@gmail.com>
2018-11-17 19:11:03 +0200
Committer
 dtrendafilov <trendafilov.dn@gmail.com>
2018-11-17 19:11:02 +0200
Files43db75a7acf93c6c2c8e07c3a87590fe14fb4e4f /homework/81030/1,2-rust2html/README.md
IPL-5729bc0ea96fc0b944c243230910c537d692bcad.tar
IPL-5729bc0ea96fc0b944c243230910c537d692bcad.tar.gz
IPL-5729bc0ea96fc0b944c243230910c537d692bcad.zip
Parent9420791a9335fc174627bea5f2a25f434bbe7ae5 (diff)
implement the second homework assignment (#39)
* Rust syntax highlighter: fix some issues with the implementation of the first homework assignment * Rust syntax highlighter: pretty-printer: implement the second homework assignment
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