Commit Graph

111 Commits

Author SHA1 Message Date
MARCHE Claude
a23f364805 Resolve "wish: use a multi-line format for source locations" 2022-06-22 18:17:43 +00:00
Guillaume Melquiond
53926bbbf5 Update headers. 2022-04-26 16:33:42 +02:00
Jean-Christophe Filliatre
f31498beda fixed Python lexer
empty comment lines were not accepted by the lexer
2021-12-09 08:48:51 +01:00
Jean-Christophe Filliatre
1c08c1987f micro Python: added def for function/predicate and type variables 2021-09-30 14:32:03 +02:00
Guillaume Melquiond
55fc17a4ea Change interface-only .ml files into .mli files. 2021-09-28 18:05:52 +02:00
Guillaume Melquiond
f75492a0db Remove dead code. 2021-09-28 17:32:00 +02:00
Guillaume Melquiond
ebfa10f2b9 Silence warning 70 "missing-mli".
OCaml warns when there is a .ml file but no .mli file. This commit adds
almost all the missing .mli files. The remaining ones are the *_ast.ml
files, as the .mli files would be verbatim copies.
2021-09-28 17:32:00 +02:00
Jean-Christophe Filliatre
d6010c82eb micro Python: types in quantifiers 2021-09-28 14:36:47 +02:00
Jean-Christophe Filliatre
d517234610 micro Python: type annotations in programs 2021-09-24 18:27:07 +02:00
Jean-Christophe Filliatre
cd46b54253 micrp Python: more types 2021-09-24 18:14:59 +02:00
Jean-Christophe Filliatre
2f06ca75cd remove use of Option.map (too recent) 2021-09-24 17:59:04 +02:00
Jean-Christophe Filliatre
8a373ad80b micro Python : syntax for types in function and predicate 2021-09-24 16:12:45 +02:00
Guillaume Melquiond
534dcdd5f5 Do not call fprintf when the string does not contain any format modifier. 2021-09-10 14:11:20 +02:00
Jean-Christophe Filliatre
33c7457915 micro-Python: fixed parsing of transformation arguments 2021-09-08 17:53:48 +02:00
paulpatault
2cc29e8963 Micro Python : syntax improvements & added functions
- added break and continue
- added range with one, two or three argument(s)
- added slice (`list[i1:i2]`)
- added negative index (`list[n], with -len(list) ≤ n < len(list)`)
- added lists methods:
  - `list.append(n)`
  - `list.pop()`
  - `list.clear()`
  - `list.sort()`
  - `list.reverse()`
- added `is_permutation(list1, list2)` predicate
- added assignment operators `+=`, `-=`, `*=`, `//=`, `%=`
- functions can now return `bool` and `list`
2021-06-24 11:44:07 +02:00
Guillaume Melquiond
1fc6be8459 Update headers. 2021-03-13 07:55:14 +01:00
Jean-Christophe Filliatre
b8719248ef micro-Python: fixed parser when no newline at end of file 2020-10-08 17:51:53 +02:00
Jean-Christophe Filliatre
cff973030c micro-C/Python: fixed translation of <> and not 2020-06-24 22:19:17 +02:00
Guillaume Melquiond
0070b9408d Update headers. 2020-03-17 09:52:33 +01:00
Sylvain Dailler
f3931e641f external printers: propagate protect_on in pretty 2019-12-06 10:31:55 +01:00
Sylvain Dailler
627275d19b ada_terms: Add task printer, transformation with args parser for Ada
This is inspired from the python printer/parser, the changes are:
- and, or, and then, or else are now supported instead of /\, \/, &&, ||
- different (LTGT) is now '/=' instead of '<>'
- allowing A'Last, A'First using "name" attributes
- allowing the notation "for all i in A .. B => stuff"
- allowing syntax for arrays as A(I) using new attributes "syntax" (also
  the reason why we need to pass a name table to the parser)
- some constants are printed as "(cst:type)" (This is not real Ada syntax
and should probably be replaced by "type'(cst)"

This also adds a test at tests/ada_terms/print_test.adb

This adds new cases in any_pp: note that all these cases are needed as we
cannot use the legacyprinter for calls to, for instance, print_ls.
This would have the disadvantage that, when printed twice (reload), idents
gets reprinted which would change their disambiguation number (break at
every reload).

Also, pass the task to the printer in order to be able to detect which
lsymbols are used in record fields definitions.

Parser edition with respect to the Why3 parser:
- Removing qualification (not usable in transformation anyway)
- QUOTE disallowed in ident: still allowing it for type variable
- the ada parser uses a naming table during the parsing phase. The naming
table does not influence the parsing but is used to generate different
trees depending on the names recognized. It is useful to distinct a
function from an array in application as the syntax is the same.

Note that the naming_table is passed with a reference: we may want to
improve this in the future (no other known solution to the author of this
message).

New attributes appears:
- [@syntax:array:] followed by name of the getter function to be used:
this is used to know which function should be used as getter for this type
during the parsing.
- [@syntax:getter:] followed by its own name: this is used to know during
the printing if the function should be removed from the display to
simplify the notation. The name is checked in case attributes of a
specific ident are derived or copied to another one.

Add README with some changes in to be changed syntax
2019-11-25 11:57:11 +01:00
Cláudio Belo Lourenço
83b02e04ac Merge branch 'master' into 28-string-literals 2019-10-21 15:05:46 +02:00
Jean-Christophe Filliatre
572064dfb8 Python plugin: minor change 2019-10-04 15:51:18 +02:00
Sylvain
974ef24c68 Merge branch 'external_printer'
This is a proof of concept of the external printing/parsing. This works by
adding externally defined (from Pretty) elements to the standard
printing/parsing. We use the example of the Python plugin to show how it
works:

- the tasks should contain new notations (example python: /\ replaced by "and")
- the new notations can be used in the transformations (example python:
  "assert (0 == 0 and b > 1)"

The file format contained in the session is used to decide which external
parser/printer to use. These are registered in a similar way that language,
parser, or transformations are registered. For example, a goal whose ancestor
is a python file (according to the file format inside the session) will be
printed with the Python external printer; and transformations originating
from this goal will be parsed with the same language.
2019-10-03 10:48:31 +02:00
Sylvain
6da047f744 external printer python: replace /\ \/ with and/or in tasks 2019-09-26 15:23:34 +02:00