CSCI 485 Lecture/Lab Notes
DISCLAIMER::: most of these are still just piccies of my handwritten
notes for the various topics
... and my handwriting is bad enough even when it's
not reduced to a jpg...
Ruby and generative programming
part 1,
part 2
generative programming lab
Ruby quicknotes
Scripts writing scripts: a look at the old NSIS installer-creation system
Assemblers and compilers
assemblers: part 1,
part 2,
part 3,
part 4,
part 5
compilers: part 1 ,
part 2,
part 3,
part 4,
part 5,
part 6,
part 7,
part 8,
part 9
tokenizing, parsing, and translating IttyBitty in Ruby
part 10,
part 11,
part 12,
bonus assignment
tokenizing SIMP in C
A lex tokenizing grammar for C
A yacc parsing grammar for C
part 13,
part 14,
part 15,
part 16
Macros and preprocessing
my quickref to C preprocessing
part 1,
part 2
part 3,
part 4,
part 5,
part 6
macro lab
Obfuscation
part 1
part 2
C++ Templates TMP
part 1,
part 2,
part 3,
part 4,
part 5,
part 6,
part 7,
part 8
C++ template metaprogramming examples (based on the CodeProject notes):
Implementing a preprocessor for Ruby
FSM to add ++ and -- to Ruby
Metaprogramming on the fly
Lisp metaprogramming on the fly:
Asm metaprogramming on the fly:
Ruby code that self modifies on the fly
can be done by building blocks of Ruby code as strings, based on
user input, and then embedding these blocks into the rest of the program.
- Building storable/passable functions using
lambda
- Allowing customized runs of methods by passing user defined blocks and running with
yields
- Allowing customized runs of methods by passing user defined blocks and running with
Proc.new.call
- A mini-interpretter to
record and run ruby code
- Dynamically adding user-defined (and callable) methods to modules using
eval
- Dynamically defining class fields and methods, and tracking their composition in hash functions:
UserCode class
- Checking if something has been defined or not at run time
defined? and respond_to?
Case studies
- Code smell and automated code cleaning: eliminating dead code,
replace duplicated code with functions/macros, parameterize for "near duplicates"
- break up long methods
- standardize whitespace/layout
- auto-initialize by data type