summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Compile/GetGrammar.hs
AgeCommit message (Collapse)Author
2023-09-25Indent each line of an error messageAndreas Källberg
By indenting each line instead of just the first, we simplify the work of the gf-lsp parser, so we can see which errors are the same
2018-01-23Remove "Warning: default encoding has changed from Latin-1 to UTF-8"Thomas Hallgren
The warning is about a change that was made in GF 3.6 (June 2014) and has probably outlived its purpose by now.
2016-09-05BNF grammars (.bnf or .cf) can have rules without semicolons, as in the GF ↵aarne
book examples. However, if the grammar has any multiline rules, all of them must have semicolons.
2016-03-21initial support for BNFC syntax in context-free grammars for GF. Not all ↵krasimir
features are supported yet. Based on contribution from Gleb Lobanov
2014-10-16More haddock documentation improvementshallgren
2014-08-25Experimental: parallel batch compilation of grammarshallgren
On my laptop these changes speed up the full build of the RGL and example grammars with 'cabal build' from ~95s to ~43s and the zero build from ~18s to ~5s. The main change is the introduction of the module GF.CompileInParallel that replaces GF.Compile and the function GF.Compile.ReadFiles.getAllFiles. At present, it is activated with the new -j flag, and it is only used when combined with --make or --batch. In addition, to get parallel computations, you need to add GHC run-time flags, e.g., +RTS -N -A20M -RTS, to the command line. The Setup.hs script has been modified to pass the appropriate flags to GF for parallel compilation when compiling the RGL and example grammars, but you need a recent version of Cabal for this to work (probably >=1.20). Some additonal refactoring were made during this work. A new monad is used to avoid warnings/error messages from different modules to be intertwined when compiling in parallel, so some functios that were hardiwred to the IO or IOE monads have been lifted to work in arbitrary monads that are instances in the appropriate classes.
2014-08-13Fix warnings in 16 modules, mostly forward compatibility warnings from GHC 7.8hallgren
2014-03-21refactor the compilation of CFG and EBNF grammars. Now they are parsed by ↵kr.angelov
using GF.Grammar.Parser just like the ordinary GF grammars. Furthermore now GF.Speech.CFG is moved to GF.Grammar.CFG. The new module is used by both the speech conversion utils and by the compiler for CFG grammars. The parser for CFG now consumes a lot less memory and can be used with grammars with more than 4 000 000 productions.
2013-12-06Show relative file paths in error messageshallgren
This is to avoid one trivial reason for failures in the test suite.
2013-11-25Change how GF deals with character encodings in grammar fileshallgren
1. The default encoding is changed from Latin-1 to UTF-8. 2. Alternate encodings should be specified as "--# -coding=enc", the old "flags coding=enc" declarations have no effect but are still checked for consistency. 3. A transitional warning is generated for files that contain non-ASCII characters without specifying a character encoding: "Warning: default encoding has changed from Latin-1 to UTF-8" 4. Conversion to Unicode is now done *before* lexing. This makes it possible to allow arbitrary Unicode characters in identifiers. But identifiers are still stored as ByteStrings, so they are limited to Latin-1 characters for now. 5. Lexer.hs is no longer part of the repository. We now generate the lexer from Lexer.x with alex>=3. Some workarounds for bugs in alex-3.0 were needed. These bugs might already be fixed in newer versions of alex, but we should be compatible with what is shipped in the Haskell Platform.
2013-11-21Some refactoring in GF.Compile and GF.Compile.GetGrammarhallgren
Move source transcoding function GF.Compile to GF.Compile.GetGrammar, in preparation for doing transcoding before lexing.
2013-11-05Eliminate mutual dependencies between the GF compiler and the PGF libraryhallgren
+ References to modules under src/compiler have been eliminated from the PGF library (under src/runtime/haskell). Only two functions had to be moved (from GF.Data.Utilities to PGF.Utilities) to make this possible, other apparent dependencies turned out to be vacuous. + In gf.cabal, the GF executable no longer directly depends on the PGF library source directory, but only on the exposed library modules. This means that there is less duplication in gf.cabal and that the 30 modules in the PGF library will no longer be compiled twice while building GF. To make this possible, additional PGF library modules have been exposed, even though they should probably be considered for internal use only. They could be collected in a PGF.Internal module, or marked as "unstable", to make this explicit. + Also, by using the -fwarn-unused-imports flag, ~220 redundant imports were found and removed, reducing the total number of imports by ~15%.
2012-11-08Eliminate warnings about deprecated use of catch and tryhallgren
This is also needed for compatibility with GHC 7.6.
2012-10-19Refactor compileSourceModulehallgren
There was 55 lines of rather repetitive code with calls to 6 compiler passes. They have been replaced with 19 lines that call the 6 compiler passes plus 26 lines of helper functions.
2012-08-29Use nub' instead of nub in some places, remove some unused nub importspeter.ljunglof
2011-11-15more structured format for errors and warnings from the compilerkr.angelov
2011-11-02merge GF.Infra.Modules and GF.Grammar.Grammar. This is a preparation for the ↵kr.angelov
separate PGF building
2011-11-02Now the compiler maintains more precise information for the source locations ↵kr.angelov
of the different definitions. There is a --tags option which generates a list of all identifiers with their source locations.
2010-11-26Add builtin preprocessors. Avoid creating tmp file. Fix multipreprocessor bug.hallgren
* The gf command line options -preproc=mkPresent and -preproc=mkMinimal now refer to internal preprocessors equivalent to lib/src/mkPresent and lib/src/mkMinimal. * The temporary file _gf_preproc.tmp is not created when running an internal preprocessor, unless there is an error, since errors messages refer to locations in the preprocessed file. (Possibly allowing the rgl build to be parallelized.) * After running an external preprocessor, the temporary file is deleted, unless there was an error. * (Bug fix) Before, when running more than one preprocessor, the same file name would be used for both input and output, e.g., mkPresent _gf_preproc.tmp > _gf_preproc.tmp which would result in an empty file being processed. Now, the input and output files will always be different.
2009-12-13reorganize the directories under src, and rescue the JavaScript interpreter ↵krasimir
from deprecated