summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Grammar
AgeCommit message (Collapse)Author
2025-08-02define return in terms of pure, >> as *>, mappend as <>Inari Listenmaa
In preparation for deprecation, see https://gitlab.haskell.org/ghc/ghc/-/wikis/proposal/semigroup-monoid and https://gitlab.haskell.org/ghc/ghc/-/wikis/proposal/monad-of-no-return
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-04Extract the previous optimization to its own functionAndreas Källberg
2022-10-04Use a Set in isInherited to speed up long extend listsAndreas Källberg
Now the time is O(log(n)*m) instead of O(n*m) where n is the number of items in the extend list e.g. abstract FromWordNet = WordNet [ a_couple_Card, a_la_carte_Adv, a_la_mode_Adv, a_little_Card, ... ];
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
2021-07-07Replace tabs for whitespace in source codeJohn J. Camilleri
2021-06-30Sort record fields in lin definitionsJohn J. Camilleri
Fixes #102
2021-06-30Make GF.Grammar.Canonical.Id a type synonym for GF.Infra.Ident.RawIdentJohn J. Camilleri
This avoids a lot of conversion back and forth between Strings and ByteStrings This commit was cherry-picked from d0c27cdaae78c670b098740bfb49b428d900e640 (lpgf branch)
2020-11-10Deleted redundant pattern matchLiyana
2020-10-08Fix syntax error problem for older versions of GHCAndreas Källberg
2020-09-12Remove MonadFail requirements for aeson codeAndreas Källberg
2020-09-05MonadFail: Make backwards-compatibleAndreas Källberg
2020-08-05Fix most build errorsAndreas Källberg
2020-08-05fix newer ghc: Don't try to be backwards compatibleAndreas Källberg
2020-08-05First attempt at fixing incompabilities with newer cabalAndreas Källberg
2020-02-18another bug related to mattern matching on multiword expressionkrangelov
2020-02-17fix: pattern matching on strings should reconstruct the tokens after matchingkrangelov
2019-09-20more dead codekrangelov
2019-09-20remove obsolete codekrangelov
2019-03-26Merge branch 'master' of https://github.com/GrammaticalFramework/gf-corekrangelov
2019-03-26bugfix in the pretty printerkrangelov
2019-03-20GF.Grammar.Canonical: pretty printer: omit some redundant bracketsThomas Hallgren
2019-03-13GF.Grammar.Canonical: some Functor/Foldable/Traversable instancesThomas Hallgren
2019-03-12Merge branch 'master' of https://github.com/GrammaticalFramework/gf-coreThomas Hallgren
2019-03-12GF.Grammar.Canonical: add TuplePattern and CommentedValueThomas Hallgren
2019-03-08canonical GF: flatten several concatenations into one json array, and parse ↵Peter Ljunglöf
the array back into concatenations
2019-03-08added parsing of json into canonical GFPeter Ljunglöf
2019-03-08remove case expressions (no particular reason)Peter Ljunglöf
2019-03-08corrected json printingPeter Ljunglöf
some object labels must be preceded by ".", to not be in conflict with GF records (which are stored as json objects) plus some minor bugfixes and cleaning
2019-03-07Expose GF.Grammar.Canonical + some refactoringThomas Hallgren
to make it available in other tools by depending on the gf package and importing it
2019-02-26replace aeson with jsonkrangelov
2019-02-08encoding/decoding canonical GF grammars to/from JSON and YAMLPeter Ljunglöf
2019-01-23Export of concrete syntax to Haskell now goes via Canonical GFThomas Hallgren
TODO: better treatment of Predef functions and record subtyping coercions
2019-01-22More work on the canonica_gf exportThomas Hallgren
+ Abstract syntax now is converted directly from the Grammar and not via PGF, so you can use `gf -batch -no-pmcfg -f canonical_gf ...`, to export to canonical_gf while skipping PMCFG and PGF file generation completely. + Flags that are normally copied to PGF files are now included in the caninical_gf output as well (in particular the startcat flag).
2019-01-18Two fixes in GF.Grammar.CanonicalThomas Hallgren
+ Hide Prelude.<> to avoid ambiguity with ghc-8.6 + Vertical alternative in the pretty printer for table types A => B
2019-01-17Adding -output-format canonical_gfThomas Hallgren
This output format converts a GF grammar to a "canonical" GF grammar. A canonical GF grammar consists of - one self-contained module for the abstract syntax - one self-contained module per concrete syntax The concrete syntax modules contain param, lincat and lin definitions, everything else has been eliminated by the partial evaluator, including references to resource library modules and functors. Record types and tables are retained. The -output-format canonical_gf option writes canonical GF grammars to a subdirectory "canonical/". The canonical GF grammars are written as normal GF ".gf" source files, which can be compiled with GF in the normal way. The translation to canonical form goes via an AST for canonical GF grammars, defined in GF.Grammar.Canonical. This is a simple, self-contained format that doesn't cover everyting in GF (e.g. omitting dependent types and HOAS), but it is complete enough to translate the Foods and Phrasebook grammars found in gf-contrib. The AST is based on the GF grammar "GFCanonical" presented here: https://github.com/GrammaticalFramework/gf-core/issues/30#issuecomment-453556553 The translation of concrete syntax to canonical form is based on the previously existing translation of concrete syntax to Haskell, implemented in module GF.Compile.ConcreteToHaskell. This module could now be reimplemented and simplified significantly by going via the canonical format. Perhaps exports to other output formats could benefit by going via the canonical format too. There is also the possibility of completing the GFCanonical grammar mentioned above and using GF itself to convert canonical GF grammars to other formats...
2018-04-18Fixes for GHC 8.4.1 compatibilityThomas Hallgren
* In GHC 8.4.1, the operator <> has become a method of the Semigroup class and is exported from the Prelude. This is unfortunate, since <> is also exported from the standard library module Text.PrettyPrint, so in any module that defines a pretty printer, there is likely to be an ambiguity. This affects ~18 modules in GF. Solution: import Prelude hiding (<>) This works also in older versions of GHC, since GHC does't complain if you hide something that doesn't exists. * In GHC 8.4.1, Semigroup has become a superclass of Monoid. This means that anywhere you define an instance of the Monoid class you also have to define an instance in the Semigroup class. This affects Data.Binary.Builder in GF. Solution: conditionally define a Semigroup instance if compiling with base>=4.11 (ghc>=8.4.1)
2017-03-07GF.Grammar.Printer now has a Terse mode which prints record types with lock ↵krasimir
fields with their corresponding abstract categories
2017-03-06added overload resolution in the experimental type checkerkrasimir
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-04-06Lexer.x: fix cyclic Functor instancehallgren
It looks like I introduced this cyclic definition in August 2014, but since it isn't used, it hasn't been a problem...
2016-03-22fix the handling of separators in BNFC which are not nonemptykrasimir
2016-03-22CFGtoPGF is now extended to support context-free grammars with primitive ↵krasimir
parameters
2016-03-21added missing module GF.Grammar.BNFCkrasimir
2016-03-21fix comment in GF.Grammar.CFGkrasimir
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
2015-09-29GF source lexer: allow numeric character escapes in string literalshallgren
This makes the output from PGF.showExpr (and other Haskell code that uses the Prelude.show function to show strings) parsable as GF source code in more cases. This is a workaround for the problem that GHC's implementation of the show function uses numeric escapes for printable non-ASCII characters, e.g. show "dålig" = "d\229lig"...
2015-09-28Preliminary new shell feature: cc -trace.hallgren
You can now do things like cc -trace mkV "debug" to see a trace of all opers with their arguments and results during the computation of mkV "debug".
2015-08-31GF.Infra.SIO: The SIO monad now supports putStr in addition to putStrLnhallgren
Also included some unrelated minor changes.