I am going to tell you about CLIP, a Command Line InterPreter for a subset of C++.
Ok, this presentation goes as follows.First I'll tell you about why CLIP was made.Then shortly of other C++ interpretersThen we discuss about main ideas in CLIP and C--, the subset of C++ which CLIP interprets.Then something about other features in CLIP.Then we compare CLIP with a normal compilerIn the end something about evaluation and then you can ask your questions.
2. Some teachers have tried to use some kind of formal structures instead of a real programming language, but that hasn't become too popular mainly due to the lack of motivation of students3. The university, the industry and other things might affect to the choice of programming language4. In the following slides, we assume that we use C++.
2. For example, students have to know what is a main function, include all libraries and know how to compile and execute their program. Students have to write all kinds of mystical spells without knowing what they actually do, for example, using namespace std. This is where an interpreter comes handy.3. In interpreter-based approach to programming education, students can start from the basic structures. They don't have to worry about compiling or running the program.
1. Ok, we already covered this topic. When we can't change the programming language, at least we can make the learning little easier.2. Novice programmers get very easily stuck when compiler gives an error which they do not fully understand. It can even take an hour from a novice programmer to correct a simple syntax error which would require a couple of seconds from an experienced programmer.3. Novice programmers do not have any routines for the lower-level programming like experts do. Thus the programming tools should be as simple as possible.
0. Ok, then shortly about other C++ interpreters. The C++ interpreters we evaluated were the following ones.7. Ch wasn't reliable enough, CINT was hard to use, UnderC and IfNCP were not available and in addition, it would have been very hard to integrate a visualization module to any of these existing interpreters.
1. There were some errors in the interpreter that were difficult to correct and the implementation was hard to develop further, so the new version of the interpreter is completely new in design and implementation.3. So, there are now two requirements, a new interpreter for the VIP environment and a command line interpreter for the interpreter-based programming education. When these two requirements were connected, we got CLIP as a result. We don't want to maintain two separate interpreters.
1. The error messages which a normal compiler gives are sometimes next to impossible to understand. This is ofter a consequence of the usage of template libraries. In CLIP, the supported subset of C++ is smaller than in compilers, which makes the error messages simpler.2. Localization to students mother language is also important because novice students may not have good english skills.3. Although C++ is an object-oriented programming language, CLIP does not support classes and is intended for imperative-first approach, which is often used when C++ is taught as the first programming language.
0. There are two different modes in which you can start CLIP: interactive mode and single file mode.2. For example, in single file mode a main function is needed and it is run automatically, when in interactive mode the main function is not needed or not special in any way.1. This is important so that students can move directly from this interpreter to normal C++ compilers.2. And then here is a list of the feature which are included in the C--.7. Methods are forbidden in structs because that would basically mean that they were classes (which are not supported).8. All these classes string, vector, cin and cout are implemented partly so that the basic usage is allowed.9. And also mathematical library is implemented partly.0. Ok, then to the features which are missing. The idea has been that by a selective use of some properties of the C++ some of its problems can be, made smaller.3. Classes are omitted with the exception that cin and cout are available for input and output. Also strings and vectors are available.9. Overloading of function names was left out because it would have been little confusing on command line when you want to change the declaration of a function.2. This means that it shows the whole line, not just the line number.3. This feature is useful when you want to see variables values.4. For example, when references are taught, pointers can be turned off. In that case the use of pointers would just result in an error message.6. An interpreter gives the feedback instantly without any need to compile the whole program first.
5. This constraint forces students to use either functions which do not alter their parameters, or procedures, which do not return a value.7. If some of these constraints is enabled, using of the feature will only cause an error message.8. So, these features are at least some extra compared to a normal compiler.Ok, you can see that the error is on the line 6 where we try to print a vector to cout. Now lets see what happened.
The compiler finds the error and tries to tell all the candidates that can be printed to cout, but in a very complex form.You can only imagine which one of these is easier to understand for a novice programmer. In addition, when using CLIP interactive mode, student would have only needed to write the two lines, the vector initialization and the cout statement. No struggling with namespaces or main function is needed.3. Some tentative tests have given encouraging feedback and the properties seem to be consistent with the requirements found in the literature.