Total source lines of code (SLOC): 359.
Author: Tijs van der Storm, CWI.
For the original description of QL see the task description of the language workbench competition 2013
How to use:
- Install VS Code
- Install the Rascal extension from the Market place
- Clone this repository https://github.com/cwi-swat/tiny-ql
- Add the folder
tiny-ql
to your VS Code workspace (don't rename the folder). - Open
src/IDE.rsc
and click on the link above themain
function.
Now, the IDE for QL is enabled, and you can open the example questionnaires in examples
.
Code overview:
Syntax.rsc
: grammar for QLResolve.rsc
: name resolutionCheck.rsc
: type checking and cyclic dependency checkingCompile.rsc
: compilation to HTML and JavascriptIDE.rsc
: IDE wiring
IDE Features:
- Syntax highlighting
- Jump-to-definition
- Hover documentation
- Error marking
- Compile button
- Code folding
- Outline
Type checker features:
Errors
- reference to undefined question
- duplicate question declaration with different type
- conditional expression not of boolean type
- operands of invalid type to operator
- computed expression not conforming to declared type.
- cyclic data and control dependencies
Warnings
- empty prompt
- empty then/else-branch
- useless condition
- dead then-branch
- redeclared with different prompt
Division by zero is caught at run time (an alert will be shown), and 0 will be returned.
Mutual exclusion "bugs" (see mutual.myql
for an example) are detected at run time and logged to the console.