Pitfalls (read before you improvise)
Workflow
- Writing the language into the ReScripted repo.
- Telling the user to
#includea JSON file as C++. - Using
nlohmann/jsonin their app as if it were required. ReScripted parses JSON itself. - Generating several alternate schemas for them to choose from.
Schema
- Renaming
functionstofuncs. - Removing unused sections.
- Putting arrays where the template has objects.
- Changing
schema.name/schema.versionwithout a real ReScripted schema release. - Filling
exampleswith C++ instead of the target language.
Engine
- Promising indentation-as-syntax, generics, or a full class model beyond single-inheritance actors/classes with methods.
- Using
#importwhile#is also a line-comment marker. - Generating CMake that registers library names. CMake only compiles files; the host calls
add_library. - Using
Language::from_filein sample code. - Forgetting
add_languagebeforeload_file. - Forgetting that default
printdoes not write to stdout. - Expecting
a[0] = 1orobj.x = 1assignment (not implemented). - Expecting closures over local
letinside an outer function. - Using
#as a decorator prefix while#is also a line comment. - Assuming
for i = 0, 10C-style loops. Usefor i 10orfor i [0,1,...]. - Thinking
evalkeeps functions around (it unloads). - Binding host functions after
loadbut using only names thatrunalready overwrote.
Amalgamate / library repo only
- Editing
include/ReScripted.hby hand. - Adding
#include "json.hpp"that is not undersrc/(amalgamate will warn and leave a dead include). - Changing
language_template.jsonas a side effect of one generated language.
License
ReScripted is LGPL-3.0-or-later. Proprietary apps may use the header. Modifications to ReScripted itself stay LGPL. Do not relicense the header to MIT in their copy without the user understanding that.