Skip to content

Introducing a new variant into js slang

martin-henz edited this page Apr 21, 2020 · 5 revisions

Code in js-slang

  1. Add variant type src/types.ts
  2. Ensure there is some way to access the new variant (typically through src/index.ts's runInContext
  3. Add support for syntax highlighting on frontend src/editors/ace/modes/source.ts
  4. Add support for prompts on frontend (after docs are done)
    • Add folder names to targets to create json for pre-declared constants / functions scripts/updateAutocompleteDocs.js
    • Add entry to builtins so frontend can reference them. Key should be in the format of 'chap_variant', where chap is the chapter number, and variant is the name of the variant type on the FRONTEND. e.g. '3_concurrent' src/editors/ace/docTooltip/index.ts

Documentation in js-slang

For filenames, replace all instances of

  • chap with the associated chapter number (e.g. 3)
  • variant with the associated variant (e.g. concurrency)

so for first example, it would be docs/md/README_3_CONCURRENCY.md

  1. Add relevant READMEs to describe new variant and libraries
    • Variant README docs/md/README_chap_variant.md
    • Library README docs/md/variant.md
  2. Edit top level README to link to new variant's page docs/md/README_TOP.md
  3. If your variant has a library: Add js library with documentation headers to describe pre-declared functions docs/lib/variant.js
  4. Setup jsdoc.sh to convert md files to html scripts/jsdoc.sh
  5. Add latex file to describe specification of new variant docs/specs/source_chap_variant.md

Code in cadet-frontend

In src/reducers/states.ts, add:

  • chapter, variant object in sourceLanguages
  • variant to display name in variantDisplay