summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Grammar/Parser.y
AgeCommit message (Collapse)Author
2023-09-11Improve syntax error messagesAndreas Källberg
Now you will get error messages like these: example.gf:1:21: Syntax error: Unexpected token '}'. Expected one of: - '{' - 'open' - an identifier
2022-10-04using an unparsable variable name in the internal desugaring of table ↵Aarne Ranta
extension to avoid captures; captures with iterated table extensions might still be possible, which needs further analysis
2022-10-03New construct: table update. Syntax t ** { cases }. Syntactic sugar for ↵aarneranta
table {cases ; vvv => t \! vvv}.t
2019-09-20remove obsolete codekrangelov
2016-04-07Lexer.x & Parser.y: add a partial parser for termshallgren
Lexer.x: Change the parser monad type P to allow the remaining input to be returned after a partial parse. Add function runPartial :: P t -> String -> Either (Posn, String) (String, t) Parser.y: Add a partial parser pTerm for nonterminal Exp1. Re-export runPartial.
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-21ModuleName and Ident are now distinct typeshallgren
This makes the documentation clearer, and can potentially catch more programming mistakes.
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-22the GF syntax for identifiers is exteded with quoted forms, i.e. you could ↵kr.angelov
write for instance 'ab.c' and then everything between the quites is identifier. This includes Unicode characters and non-ASCII symbols. This is useful for automatically generated GF grammars.
2013-10-30added the linref construction in GF. The PGF version number is now bumpedkr.angelov
2013-09-19Introduce type RawIdent; only 9 imports of Data.ByteString.Char8 remainhallgren
The fact that identifiers are represented as ByteStrings is now an internal implentation detail in module GF.Infra.Ident. Conversion between ByteString and identifiers is only needed in the lexer and the Binary instances.
2013-09-19Make Ident abstract; imports of Data.ByteString.Char8 down from 29 to 16 moduleshallgren
Most of the explicit uses of ByteStrings were eliminated by using identS, identS = identC . BS.pack which was found in GF.Grammar.CF and moved to GF.Infra.Ident. The function prefixIdent :: String -> Ident -> Ident allowed one additional import of ByteString to be eliminated. The functions isArgIdent :: Ident -> Bool getArgIndex :: Ident -> Maybe Int were needed to eliminate explicit pattern matching on Ident from two modules.
2013-08-07Better error messages for attempts to redefine predefined constantshallgren
Instead of just "syntax error", you now get e.g. PType is a predefined constant, it can not be redefined This is a simple change in the parser.
2013-02-12now the beam size for the statistical parser can be configured by using the ↵kr.angelov
flag beam_size in the top-level concrete module
2013-01-28Quick fix to render some parser error messages from UTF-8-encoded source ↵hallgren
files correctly. The parser works on raw byte sequences read from source files. If parsing succeeds the raw byte sequences are converted to proper Unicode characters in a later phase. But the parser calls the function buildAnyTree, which can fail and generate error messages containing source code fragments, which might then containing raw byte sequences. To render these error messages correctly, they need to be converted in accordance with the coding flag in the source file. This is now done for UTF-8-encoded source files, but should ideally also be done for other character encodings. (Latin-1-encoded files never suffered from this problem, since raw bytes are proper Unicode characters in this case.)
2011-11-15more structured format for errors and warnings from the compilerkr.angelov
2011-11-10Now PMCFG is compiled per module and at the end we only link it. The new ↵kr.angelov
compilation schema is few times faster.
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.
2011-09-22change the precedence for the left argument of ->kr.angelov
2011-07-21GenIP, GenRP in Extra and any_Quant in ExtraEngaarne
2011-03-12make it possible to override opers defined in an interface by syntax ↵aarne
'instance Foo of Bar - [f,g,h]'
2010-11-15bugfix for the abstract operationskrasimir
2010-11-12operations in the abstract syntaxkrasimir
2010-05-28refactoring in GF.Grammar.Grammarkrasimir
2010-04-19use the native unicode support from GHC 6.12krasimir
2010-03-22fix checkInfoType in Parser.ykrasimir
2010-03-22store and propagate the exact source location for all judgements in the ↵krasimir
grammar. It may not be used accurately in the error messages yet
2010-03-18fix the precedence for patterns ~, - and @krasimir
2010-03-18syntax for inaccessible patterns in GFkrasimir
2010-02-16no need to keep the list of constructors per category in .gfokrasimir
2010-01-31refactor GF.Infra.Modules for better error messageskrasimir
2009-12-13reorganize the directories under src, and rescue the JavaScript interpreter ↵krasimir
from deprecated