- Programming language reference for multiple languages
- For each language: Examples of: variables, iteration, if-statements, functions, open-file, split-strings, etc
- Select one language, or multiple languages (to compare)
- Printable
- At the foundation level, most languages can perform arithmetic, print to the screen and loop over a sequence. When used at the high levels, languages can be very different, but most of those concepts/patterns/advanced-features are not understandable/relevant to beginners.
- From the beginning, Learners don't identify as knowing one language. They understand that the foundation concepts apply across multiple languages. This encourages them to identify as a 'programmer' rather than just a 'python programmer'.
- With language_reference the learners can be supported in moving between languages freely.
- Lesson can be delivered in different languages.
- Advanced learners can use language_reference to tackle a task in a different language to the rest of a class
- 1 sheet A4 (duplexed) split into 4 columns for 4 languages. One sheet is not overwhelming. It can be given at the start of a course and be a familiar recurring aid. Saying "Just one column of this sheet is all the core programming constructs you need for the exam" gives a finite visual representation. Students can measure there progress on how much of the column they understand.
- Keeping the exact syntax of 5 languages in your head at once over years can be tricky. The sheet can be used a quick lookup/refresher.
- 2008: Created a resource for teaching A-Level Computing and demoed it at the first ComputingAtSchool conference in 2009
- 2012: Started the
TeachProgrammingrepo with a custom version builder to split small code projects into diff chunks for learners to incrementally build mini projects.- LanguageCheetSheet.odt an early versions of an OpenOffice document
- 2021: Created dynamic html language renderer
- 2026: Moved language_reference to it's own repository
make_ver- A tool to break a single source file into multiple versions.
- Versions are marked by the comment at the end of a line with
VER: name
static- Dynamic html/js renderers for the data derived from
make_ver
- Dynamic html/js renderers for the data derived from
verify_snippets(for projects)- Automated test suite for incremental versions.
- Run tests to assert that each project version outputted compiles (and maybe runs).
flowchart TD
python.py --> make_ver.py
Java.java --> make_ver.py
rust.rs --> make_ver.py
csharp.cs --> make_ver.py
... --> make_ver.py
make_ver.py --> api.py --> language_reference.json --> Browser
/static/language_reference.html --> Browser
flowchart TD
copter.ver.json --> make_ver.py
copter.py --> make_ver.py
copter.java --> make_ver.py
... --> make_ver.py
make_ver.py --> api.py --> copter.json --> Browser
/static/projects.html --> Browser
copter.json --> verify_snippets
- Uses version by having a single source file for a language and marking each line with version name
- Examples
python.example.py
a = 1 # VER: arithmetic
print('hello') # VER: outputjava.example.java
int a = 1; // VER: arithmetic
System.out.println('hello'); // VER: outputThese versions are outputted to language_reference.json.
The above language_reference.json is rendered by html/js /static/language_reference.html to look something like the table below:
| py | java | |
|---|---|---|
| arithmetic | a = 1 |
int a = 1; |
| output | print('hello') |
System.out.println('hello'); |
- Uses versions by having a sequence of versions to build-up a complete solution incrementally
- Full Example
- copter.ver.json
- This is output to
game/copter.jsonwhich contains all the incremental versions of the copter project for all input languages
Because projects are bigger and could contain further assets, projects are typically stored in another repo.
make_ver and 'html/js project renderer' are stored in this repo because the functionality is built on the foundations that are used in generating language_reference versions and renderer.
- A folder is recursively crawled for all
.verfiles. - For each
NAME.verfile, all the languages that are loaded e.g.NAME.py+NAME.java+NAME.cs - A set of diff's are made for each version name incrementally (output to
projects.json) /static/projects.htmlA html/js viewer renders the diffs for each language
- There might be many incremental versions of a file (e.g.
copter.xxxhas 8 versions). - How do we know that all the possible versions are syntactically correct (can compile) and run?
- The final/complete output may be valid, but the incremental steps to get there may be broken/incomplete
- To detect this, we can generate each potential version and:
- run it through a compiler to check it compiles
- (optional) run the program (this is optional and can be difficult for programs that need user input, graphics output or network communication)