@@ -46,6 +46,17 @@ Tools (in this repo)
4646 * Automated test suite for incremental versions.
4747 * Run tests to assert that each project version outputted compiles (and maybe runs).
4848
49+ ``` mermaid
50+ flowchart TD
51+
52+ python.py --> make_ver.py
53+ Java.java --> make_ver.py
54+ rust.rs --> make_ver.py
55+ csharp.cs --> make_ver.py
56+
57+ make_ver.py --> api.py --> language_reference.json --> Browser
58+ /static/language_reference.html --> Browser
59+ ```
4960
5061Example Versions
5162----------------
@@ -58,18 +69,36 @@ Example Versions
5869 * [ Java.java] ( ./language_reference/languages/java/Java.java )
5970
6071
72+ ` python.example.py `
6173``` python
6274a = 1 # VER: arithmetic
6375print (' hello' ) # VER: output
6476```
6577
78+ ` java.example.java `
79+ ``` java
80+ int a = 1 ; // VER: arithmetic
81+ System . out. println(' hello' ); // VER: output
82+ ```
83+
84+ These versions are outputted to ` language_reference.json ` .
85+
86+ The above ` language_reference.json ` is rendered by html/js to look something like the table below:
87+
88+ | | py | java |
89+ | ----------| ----------------| ------------------------------|
90+ | arithmetic| ` a = 1 ` | ` int a = 1; ` |
91+ | output | ` print('hello') ` | ` System.out.println('hello'); ` |
92+
93+
6694### ` projects `
6795
6896* Uses versions by having a sequence of versions to build-up a complete solution incrementally
69- * Example
97+ * Full Example
7098 * [ copter.ver.json] ( https://github.com/calaldees/TeachProgramming/blob/master/teachprogramming/static/projects/game/copter.ver.json )
71- * [ copter.html] ( https://github.com/calaldees/TeachProgramming/blob/master/teachprogramming/static/projects/game/copter.html )
72- * [ copter.py] ( https://github.com/calaldees/TeachProgramming/blob/master/teachprogramming/static/projects/game/copter.py )
99+ * [ copter.html] ( https://github.com/calaldees/TeachProgramming/blob/master/teachprogramming/static/projects/game/copter.html )
100+ * [ copter.py] ( https://github.com/calaldees/TeachProgramming/blob/master/teachprogramming/static/projects/game/copter.py )
101+ * This is output to ` game/copter.json ` which contains all the incremental versions of the copter project for all input languages
73102
74103
75104Projects
@@ -80,10 +109,16 @@ Because projects are bigger and could contain further assets, projects are typic
80109
81110* A folder is recursively crawled for all ` .ver ` files.
82111* For each ` NAME.ver ` file, all the languages that are loaded e.g. ` NAME.py ` +` NAME.java ` +` NAME.cs `
83- * A set of diff's are made for each version name incrementally
112+ * A set of diff's are made for each version name incrementally (output to ` projects.json ` )
84113* A html/js viewer renders the diffs for each language
85114
86115
87116` verify_snippets ` (for projects)
88117-----------------
89118
119+ * There might be many incremental versions of a file (e.g. ` copter.xxx ` has 8 versions).
120+ * How do we know that all the possible versions are syntactically correct (can compile) and run?
121+ * The final/complete output may be valid, but the incremental steps to get there may be broken/incomplete
122+ * To detect this, we can generate each potential version and:
123+ * run it through a compiler to check it compiles
124+ * (optional) run the program (this is optional and can be difficult for programs that need user input, graphics output or network communication)
0 commit comments