User Tools

Site Tools


technology:dsls_in_c_cpp

Making DSLs in C/C++

  • TODO: X-Macros
  • TODO: Embedded programming is mostly a matter of making a DSL to talk about hardware operations (usually single write or read instructions to a particular address)
  • TODO: Print_D, PrintLine_D, WriteLine_D, WriteLine_E, etc. naming conventions for an array of options. Readability and variable de-cluttering
  • TODO: VarArrayAdd(type, …) etc. Use macros as a way to do loose type-checking on “templated” API functions and structs, Andrew Reece's talk about parameter packing and register usage for XAR API
  • TODO: Downsides: Multiple evaluation, single statement assumption, parenthesis around parameters, etc.
  • TODO: Using macros to implement a crude form of function overloading?
  • TODO: Using macros to pass debug information about call-site with FILE, LINE and func
  • TODO: Infix-like syntax with: #define _(left, op, right) op(left, right)` → `_(a, Add, _(b, Mul, c))
  • TODO: X-Macros as a form of table-based code-gen
  • TODO: Scraping DSL's inside comments or #if 0 blocks before compilation to do basic codegen
  • TODO: Generating code from .meta files approach in RAD Debugger, X-Macros comparison, scraping comparison
technology/dsls_in_c_cpp.txt · Last modified: by Taylor Robbins