|
| 1 | + |
| 2 | +.. _about: |
| 3 | + |
| 4 | +About Alex |
| 5 | +========== |
| 6 | + |
| 7 | +Alex can always be obtained from its `home |
| 8 | +page <http://www.haskell.org/alex>`__. The latest source code lives in |
| 9 | +the `git repository <https://github.com/simonmar/alex>`__ on ``GitHub``. |
| 10 | + |
| 11 | +.. _relnotes-30: |
| 12 | + |
| 13 | +Release Notes for version 3.0 |
| 14 | +----------------------------- |
| 15 | + |
| 16 | +- Unicode support (contributed mostly by Jean-Philippe Bernardy, with |
| 17 | + help from Alan Zimmerman). |
| 18 | + |
| 19 | + - An Alex lexer now takes a UTF-8 encoded byte sequence as input |
| 20 | + (see :ref:`Unicode and UTF-8 <encoding>`. If you are using the |
| 21 | + "basic" wrapper or one of the other wrappers that takes a Haskell |
| 22 | + ``String`` as input, the string is automatically encoded into |
| 23 | + UTF-8 by Alex. If your input is a ``ByteString``, you are |
| 24 | + responsible for ensuring that the input is UTF-8 encoded. The old |
| 25 | + 8-bit behaviour is still available via the ``--latin1`` option. |
| 26 | + |
| 27 | + - Alex source files are assumed to be in UTF-8, like Haskell source |
| 28 | + files. The lexer specification can use Unicode characters and |
| 29 | + ranges. |
| 30 | + |
| 31 | + - ``alexGetChar`` is renamed to ``alexGetByte`` in the generated |
| 32 | + code. |
| 33 | + |
| 34 | + - There is a new option, ``--latin1``, that restores the old |
| 35 | + behaviour. |
| 36 | + |
| 37 | +- Alex now does DFA minimization, which helps to reduce the size of the |
| 38 | + generated tables, especially for lexers that use Unicode. |
| 39 | + |
| 40 | +.. _relnotes-22: |
| 41 | + |
| 42 | +Release Notes for version 2.2 |
| 43 | +----------------------------- |
| 44 | + |
| 45 | +- Cabal 1.2 is now required. |
| 46 | + |
| 47 | +- ByteString wrappers: use Alex to lex ByteStrings directly. |
| 48 | + |
| 49 | +.. _relnotes-210: |
| 50 | + |
| 51 | +Release Notes for version 2.1.0 |
| 52 | +------------------------------- |
| 53 | + |
| 54 | +- Switch to a Cabal build system: you need a recent version of Cabal |
| 55 | + (1.1.6 or later). If you have GHC 6.4.2, then you need to upgrade |
| 56 | + Cabal before building Alex. GHC 6.6 is fine. |
| 57 | + |
| 58 | +- Slight change in the error semantics: the input returned on error is |
| 59 | + before the erroneous character was read, not after. This helps to |
| 60 | + give better error messages. |
| 61 | + |
| 62 | +.. _relnotes-20: |
| 63 | + |
| 64 | +Release Notes for version 2.0 |
| 65 | +----------------------------- |
| 66 | + |
| 67 | +Alex has changed a *lot* between versions 1.x and 2.0. The following is |
| 68 | +supposed to be an exhaustive list of the changes: |
| 69 | + |
| 70 | +.. _changes-syntax: |
| 71 | + |
| 72 | +Syntax changes |
| 73 | +~~~~~~~~~~~~~~ |
| 74 | + |
| 75 | +- Code blocks are now surrounded by ``{...}`` rather than ``%{...%}``. |
| 76 | + |
| 77 | +- Character-set macros now begin with ‘\ ``$``\ ’ instead of |
| 78 | + ‘\ ``^``\ ’ and have multi-character names. |
| 79 | + |
| 80 | +- Regular expression macros now begin with ‘\ ``@``\ ’ instead of |
| 81 | + ‘\ ``%``\ ’ and have multi-character names. |
| 82 | + |
| 83 | +- Macro definitions are no longer surrounded by ``{ ... }``. |
| 84 | + |
| 85 | +- Rules are now of the form |
| 86 | + |
| 87 | + :: |
| 88 | + |
| 89 | + <c1,c2,...> regex { code } |
| 90 | + |
| 91 | + where ``c1``, ``c2`` are startcodes, and ``code`` is an arbitrary |
| 92 | + Haskell expression. |
| 93 | + |
| 94 | +- Regular expression syntax changes: |
| 95 | + |
| 96 | + - ``()`` is the empty regular expression (used to be ‘\ ``$``\ ’) |
| 97 | + |
| 98 | + - set complement can now be expressed as ``[^sets]`` (for similarity |
| 99 | + with lex regular expressions). |
| 100 | + |
| 101 | + - The ``'abc'`` form is no longer available, use ``[abc]`` instead. |
| 102 | + |
| 103 | + - ‘\ ``^``\ ’ and ‘\ ``$``\ ’ have the usual meanings: ‘\ ``^``\ ’ |
| 104 | + matches just after a ‘\ ``\n``\ ’, and ‘\ ``$``\ ’ matches just |
| 105 | + before a ‘\ ``\n``\ ’. |
| 106 | + |
| 107 | + - ‘\ ``\n``\ ’ is now the escape character, not ‘\ ``^``\ ’. |
| 108 | + |
| 109 | + - The form ``"..."`` means the same as the sequence of characters |
| 110 | + inside the quotes, the difference being that special characters do |
| 111 | + not need to be escaped inside ``"..."``. |
| 112 | + |
| 113 | +- Rules can have arbitrary predicates attached to them. This subsumes |
| 114 | + the previous left-context and right-context facilities (although |
| 115 | + these are still allowed as syntactic sugar). |
| 116 | + |
| 117 | +.. _changes-files: |
| 118 | + |
| 119 | +Changes in the form of an Alex file |
| 120 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 121 | + |
| 122 | +- Each file can now only define a single grammar. This change was made |
| 123 | + to simplify code generation. Multiple grammars can be simulated using |
| 124 | + startcodes, or split into separate modules. |
| 125 | + |
| 126 | +- The programmer experience has been simplified, and at the same time |
| 127 | + made more flexible. See |
| 128 | + :ref:`The Interface to an Alex-generated lexer <api>` for details. |
| 129 | + |
| 130 | +- You no longer need to import the ``Alex`` module. |
| 131 | + |
| 132 | +.. _changes-usage: |
| 133 | + |
| 134 | +Usage changes |
| 135 | +~~~~~~~~~~~~~ |
| 136 | + |
| 137 | +The command-line syntax is quite different. See :ref:`Invoking Alex <invoking>`. |
| 138 | + |
| 139 | +.. _changes-implementation: |
| 140 | + |
| 141 | +Implementation changes |
| 142 | +~~~~~~~~~~~~~~~~~~~~~~ |
| 143 | + |
| 144 | +- A more efficient table representation, coupled with standard |
| 145 | + table-compression techniques, are used to keep the size of the |
| 146 | + generated code down. |
| 147 | + |
| 148 | +- When compiling a grammar with GHC, the -g switch causes an even |
| 149 | + faster and smaller grammar to be generated. |
| 150 | + |
| 151 | +- Startcodes are implemented in a different way: each state corresponds |
| 152 | + to a different initial state in the DFA, so the scanner doesn't have |
| 153 | + to check the startcode when it gets to an accept state. This results |
| 154 | + in a larger, but quicker, scanner. |
| 155 | + |
| 156 | +.. _bug-reports: |
| 157 | + |
| 158 | +Reporting bugs in Alex |
| 159 | +---------------------- |
| 160 | + |
| 161 | +Please report bugs in Alex to [email protected]. There are no |
| 162 | +specific mailing lists for the discussion of Alex-related matters, but |
| 163 | +such topics should be fine on the `Haskell |
| 164 | +Cafe <http://www.haskell.org/mailman/listinfo/haskell-cafe>`__ mailing |
| 165 | +list. |
| 166 | + |
| 167 | +License |
| 168 | +------- |
| 169 | + |
| 170 | +Copyright (c) 1995-2011, Chris Dornan and Simon Marlow. All rights |
| 171 | +reserved. |
| 172 | + |
| 173 | +Redistribution and use in source and binary forms, with or without |
| 174 | +modification, are permitted provided that the following conditions are |
| 175 | +met: |
| 176 | + |
| 177 | +- Redistributions of source code must retain the above copyright |
| 178 | + notice, this list of conditions and the following disclaimer. |
| 179 | + |
| 180 | +- Redistributions in binary form must reproduce the above copyright |
| 181 | + notice, this list of conditions and the following disclaimer in the |
| 182 | + documentation and/or other materials provided with the distribution. |
| 183 | + |
| 184 | +- Neither the name of the copyright holders, nor the names of the |
| 185 | + contributors may be used to endorse or promote products derived from |
| 186 | + this software without specific prior written permission. |
| 187 | + |
| 188 | +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS |
| 189 | +IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
| 190 | +TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
| 191 | +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER |
| 192 | +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 193 | +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 194 | +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 195 | +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 196 | +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 197 | +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 198 | +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
0 commit comments