aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/pre_parser.mly
Commit message (Collapse)AuthorAgeFilesLines
* One cosmetic change of [option] to [?]. No impact.François Pottier2015-10-071-1/+1
|
* Factorized the two forms of FOR statement by introducing [for_statement_header].François Pottier2015-10-071-2/+6
| | | | This leads to a smaller automaton.
* Introduced optional(X, Y), which means X? Y, and used it in array ↵François Pottier2015-10-071-4/+12
| | | | | | declarators and FOR loops. This leads to fewer automaton states, and potentially better error messages.
* Factorized the productions for several categories of binary operators.François Pottier2015-10-071-13/+20
| | | | | | | This leads to a small savings in the number of states (which could become greater in the future if we decide to parameterize expressions). If desired, the old automaton could be recovered by marking the binary operators as %inline.
* Factorized two productions (and two error productions) in [enum_specifier].François Pottier2015-10-071-5/+2
| | | | This is analogous to the previous commit.
* Factorized two productions (and two error productions) in ↵François Pottier2015-10-071-5/+2
| | | | | | | | | | | [struct_or_union_specifier]. The old version was strictly equivalent to using [ioption(other_identifier)]. The new version uses [option(other_identifier)] instead, that is, [other_identifier?]. Technically, this means that [set_id_type i OtherId] is called slightly earlier (at the opening brace, instead of at the closing brace), but this does not make any difference, since the re-classification of identifiers affects only the second parsing phase.
* For clarity, removed several redundant calls to [set_id_type].François Pottier2015-10-071-9/+5
| | | | | | | A TYPEDEF_NAME is already classified as a [TypedefId] by the lexer, and similarly, a VAR_NAME is already classified as a [VarId]. Thus, the removed calls had no effect. The remaining calls to [set_id_type] are useful, as they can re-classify a token.
* Introduced [other_identifier] as a more elegant way of calling [set_id_type ↵François Pottier2015-10-071-19/+22
| | | | | | i OtherId]. This causes no change in the automaton.
* One more replacement of [ioption] with [option].François Pottier2015-10-071-1/+1
| | | | I missed this opportunity in the previous commit.
* Use [option] as much as possible and [ioption] only where necessary.François Pottier2015-10-071-13/+30
| | | | | | | | | The existing [option(X)] was marked %inline, and has been renamed [ioption(X)]. A new [option(X)], which is not marked %inline, has been introduced. The grammar now uses [option] everywhere, except where [ioption] is necessary in order to avoid conflicts. This reduces the number of states in the automaton. The number of LR(0) cores drops from 857 to 712.
* Add whitespace, for better vertical alignment and better readability.François Pottier2015-10-071-21/+13
| | | | This violates the 80-column width limit, but is really important.
* Fixed a few bugs in the pre parser. In particular, the following codeJacques-Henri Jourdan2015-09-301-102/+234
| | | | | | | | | | | | | | | was not parsed correctly: typedef int a; int f() { for(int a; ;) if(1); a * x; } Additionnaly, I tried to add some comments in the pre-parser code, especially for the different hacks used to solve various conflicts.
* Experiment: support a subset of GCC's extended asm statements.Xavier Leroy2015-04-171-1/+37
|
* Support "asm volatile" (closes: PR#5).Xavier Leroy2014-12-291-1/+1
| | | | The CompCert back-end already treats "asm" inserts as "volatile" in GCC's sense (performing unpredictable side-effects), so no change is required outside of the parser.
* Empty declarationsjjourdan2014-05-231-0/+2
| | | | git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2502 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
* Typo in struct_declaration_list causing conflicts.xleroy2014-05-181-1/+1
| | | | git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2497 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
* - Re-added support for "__func__" identifier as per ISO C99.xleroy2014-05-151-0/+1
| | | | | | | | - Support for empty structs and unions - Better handling of "extern" and "extern inline" function definitions. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2493 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
* Assorted fixes to fix parsing issues and be more GCC-like:xleroy2014-05-121-2/+3
| | | | | | | | | | - Moved scanning of char constants and string literals entirely to Lexer - Parser: separate STRING_LITERAL from CONSTANT to be closer to ISO C99 grammar - pre_parser: adapted + "asm" takes string_literal, not CONSTANT - Revised errors "inline doesnt belong here" git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2492 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
* Do not allow typedef_name in identifier lists of K&R style definitionsjjourdan2014-05-051-4/+4
| | | | git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2479 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
* Support for old-style K&R function definitions.xleroy2014-05-051-0/+22
| | | | git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2478 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
* Treat all identifiers as VAR_NAME by default (i.e. if not bound by a ↵xleroy2014-05-051-3/+1
| | | | | | typedef). This produces better error messages for unbound variable names (proper error message in Elab rather than cryptic syntax error in pre_parser). git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2477 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
* Integration of Jacques-Henri Jourdan's verified parser.xleroy2014-04-291-0/+658
(Merge of branch newparser.) git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2469 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e