Skip to content

Embedding C

Dibyendu Majumdar edited this page Aug 29, 2021 · 21 revisions

Embedding C

Since C is the intermediate language used when generating machine code, we can allow a subset of C as an embedded high performance language.

It does not need to be full blown C as that would be too risky. Instead the goal should be to allow C to write snippets of high performance code.

Following features will not be provided:

  • Preprocessor
  • Ability to call functions or allocate memory
  • The interaction between Ravi and C will be limited to userdata types and primitive types / primitive arrays and strings. No access to Lua tables.

Proposed syntax

A new keyword C will be added. It will take a string argument.

C [[
   typedef struct MyStruct {
      int i;
  };
]]
Clone this wiki locally