Skip to content

lefticus/cons_expr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cons_expr

ci codecov CodeQL

About cons_expr

cons_expr is:

  • Scheme-inspired
    • scheme syntax and features
    • does not support pairs or macros
    • any value once captured is const
    • any redefinition of a value shadows the previous value
  • Constexpr-capable
    • cons_expr::cons_expr is constinit meaning that it is always 0-cost to construct a cons_expr interpreter
    • Any script can be executed at compile time.
    • Why execute script at compile time?
      • I don't know your other use cases
      • But you can use this feature to set up your entire scripting environment at compile time, then execute scripts at runtime
  • Simple and small
    • I'm attempting to keep the code as compact as possible. As of now it is "feature complete." Any additional features will go as add-ons in the "utility" header
    • I'm not happy with the fix_identifiers family of functions. They need to be simplified and made better.
    • Compilation of entire engine is just a few seconds, even with optimizations.
  • Easy to use
    • Include one header and go! See examples.
  • Embeddable scripting language
    • Bi-directional support for functions between script and C++.
    • All supported types must be known at compile time.
  • For C++23
    • Currently only known to work with GCC 13.1.

Command Line Inspection Tool

ccons_expr can be used to execute scripts and inspect the state of the runtime system live

asciicast

Important Notes

  • Objects are never destroyed, but because they are treated as immutable, they are reused as much as possible.
  • All types contained in the script are required to be trivial
  • If you expand beyond the statically allocated storage, dynamic storage is utilized. If you maintain dynamic storage from compile-time to run-time, you will get a compile time error.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published