Skip to content

Commit 01ad297

Browse files
authored
Merge pull request github#3170 from shati-patel/21-ql-language
CodeQL docs: Update intros in QL handbook and QL spec
2 parents 675144c + 5bf0a08 commit 01ad297

File tree

11 files changed

+27
-20
lines changed

11 files changed

+27
-20
lines changed

docs/language/ql-handbook/aliases.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
Aliases
55
#######
66

7-
An alias is an alternative name for an existing QL entity. Once you've defined an alias,
8-
you can use that new name to refer to the entity in the current module's :ref:`namespace <namespaces>`.
7+
An alias is an alternative name for an existing QL entity.
8+
9+
Once you've defined an alias, you can use that new name to refer to the entity in the current module's :ref:`namespace <namespaces>`.
910

1011
Defining an alias
1112
*****************

docs/language/ql-handbook/annotations.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Annotations
44
###########
55

66
An annotation is a string that you can place directly before the declaration of a QL entity or name.
7+
78
For example, to declare a module ``M`` as private, you could use::
89

910
private module M {

docs/language/ql-handbook/evaluation.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
Evaluation of QL programs
44
#########################
55

6+
A QL program is evaluated in a number of different steps.
7+
68
Process
79
*******
810

docs/language/ql-handbook/expressions.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
Expressions
44
###########
55

6-
An expression evaluates to a set of values in QL. For example, the expression ``1 + 2``
7-
evaluates to the integer ``3`` and the expression ``"QL"`` evaluates to the string ``"QL"``.
6+
An expression evaluates to a set of values and has a type.
87

9-
A valid expression also has a :ref:`type <types>`.
10-
In the above examples, ``1 + 2`` has type ``int`` and ``"QL"`` has type ``string``.
8+
For example, the expression ``1 + 2``
9+
evaluates to the integer ``3`` and the expression ``"QL"`` evaluates to the string ``"QL"``. ``1 + 2`` has :ref:`type <types>` ``int`` and ``"QL"`` has type ``string``.
1110

1211
The following sections describe the expressions that are available in QL.
1312

docs/language/ql-handbook/formulas.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
Formulas
44
########
55

6-
Formulas define logical relations between the :ref:`free variables <free-variables>` used in
7-
:ref:`expressions <expressions>`.
6+
Formulas define logical relations between the free variables used in expressions.
87

9-
Depending on the values assigned to those free variables, a formula can be true or false.
8+
Depending on the values assigned to those :ref:`free variables <free-variables>`, a formula can be true or false.
109
When a formula is true, we often say that the formula *holds*.
1110
For example, the formula ``x = 4 + 5`` holds if the value ``9`` is assigned to ``x``, but it
1211
doesn't hold for other assignments to ``x``.

docs/language/ql-handbook/lexical-syntax.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
Lexical syntax
44
##############
55

6+
The QL syntax includes different kinds of keywords, identifiers, and comments.
7+
68
For an overview of the lexical syntax, see `Lexical syntax
7-
<https://help.semmle.com/QL/ql-spec/language.html#lexical-syntax>`_
8-
in the QL language specification. In particular, you can find the list of QL keywords, the
9-
different kinds of identifiers, and a description of comments.
9+
<https://help.semmle.com/QL/ql-spec/language.html#lexical-syntax>`_ in the QL language specification.
1010

1111
.. index:: comment, QLDoc
1212
.. _comments:

docs/language/ql-handbook/name-resolution.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
Name resolution
44
###############
55

6+
The QL compiler resolves names to program elements.
7+
68
As in other programming languages, there is a distinction between the names used in QL code,
79
and the underlying QL entities they refer to.
810

docs/language/ql-handbook/queries.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44
Queries
55
#######
66

7-
Queries are the output of a QL program: they evaluate to sets of results. Indeed, we
8-
often refer to the whole QL program as a *query*.
7+
Queries are the output of a QL program. They evaluate to sets of results.
98

109
There are two kinds of queries. For a given :ref:`query module <query-modules>`, the queries in that module are:
1110
- The :ref:`select clause <select-clauses>`, if any, defined in that module.
1211
- Any :ref:`query predicates <query-predicates>` in that module's predicate
1312
:ref:`namespace <namespaces>`. That is, they can be defined in the module itself, or
1413
imported from a different module.
1514

15+
We often also refer to the whole QL program as a query.
16+
1617
.. index:: from, where, select
1718
.. _select-clauses:
1819

docs/language/ql-handbook/types.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
Types
66
#####
77

8-
QL is a statically typed language, so each variable must have a declared **type**. A type is a set of values.
8+
QL is a statically typed language, so each variable must have a declared type.
9+
10+
A type is a set of values.
911
For example, the type ``int`` is the set of integers.
1012
Note that a value can belong to more than one of these sets, which means that it can have more
1113
than one type.

docs/language/ql-handbook/variables.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ Variables
55
#########
66

77
Variables in QL are used in a similar way to variables in algebra or logic. They represent sets
8-
of values, and those values are usually restricted by a :ref:`formula <formulas>`.
8+
of values, and those values are usually restricted by a formula.
99

1010
This is different from variables in some other programming languages, where variables represent
1111
memory locations that may contain data. That data can also change over time. For example, in
12-
QL, ``n = n + 1`` is an equality formula that holds only
12+
QL, ``n = n + 1`` is an equality :ref:`formula <formulas>` that holds only
1313
if ``n`` is equal to ``n + 1`` (so in fact it does not hold for any numeric value).
1414
In Java, ``n = n + 1`` is not an equality, but an assignment that changes the value of ``n`` by
1515
adding ``1`` to the current value.

0 commit comments

Comments
 (0)