90 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
1c08c1987f micro Python: added def for function/predicate and type variables 2021-09-30 14:32:03 +02:00
Guillaume Melquiond
f75492a0db Remove dead code. 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
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
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
Sylvain
c05e74efef external printer: add "!=" 2019-09-25 17:39:52 +02:00
Sylvain
212ea87ccd external python printer: fix parenthesis 2019-09-25 17:29:43 +02:00
Sylvain
cb1e8f28c6 external python printer/parser: div -> // and mod -> % 2019-09-25 17:23:49 +02:00
Sylvain
d47ea7b5b0 external_printer: protect priority and fix indentation 2019-09-25 16:32:30 +02:00
Sylvain
1259ec07c8 external printer/parser: task printer/parser depends of the language
An external printer/argument parser can now be registered. This changes
args_wrapper and Trans so that transformation now takes the Env.fformat
representing the language as argument.
Function lang of session_itp now uses file_format.
2019-09-25 16:32:30 +02:00