1
0
forked from GitHub/gf-core
Commit Graph

50 Commits

Author SHA1 Message Date
krangelov 6efb878c43 pattern matching for "x"* 2021-09-29 14:57:18 +02:00
krangelov edd7081dea implement measured patterns 2021-09-29 13:26:06 +02:00
krangelov 155657709a Merge branch 'master' into c-runtime 2021-07-30 11:20:04 +02:00
John J. Camilleri f2e52d6f2c Replace tabs for whitespace in source code 2021-07-07 09:40:41 +02:00
krangelov acb70ccc1b cleanup 2019-09-19 22:30:08 +02:00
krangelov 4a71464ca7 Merge with master and drop the Haskell runtime completely 2019-09-19 22:01:57 +02:00
krangelov 1e9188ea60 bugfix in the pretty printer 2019-03-26 12:21:35 +01:00
Krasimir Angelov 5a2b200948 manually copy the "c-runtime" branch from the old repository. 2018-11-02 14:38:44 +01:00
Thomas Hallgren 820d2d503f Fixes for GHC 8.4.1 compatibility
* 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)
2018-04-18 19:18:10 +02:00
krasimir 5ec43f2f75 GF.Grammar.Printer now has a Terse mode which prints record types with lock fields with their corresponding abstract categories 2017-03-07 08:24:00 +00:00
hallgren 54ae70a81e Changes for compatibility with ghc-7.10-rc2
2 modules: Name clashes caused by Applicative-Monad change in Prelude
2 modules: Ambiguities caused by Foldable/Traversable in Prelude
2 modules: Backwards incompatible changes in time-1.5 for defaultTimeLocale
9 modules: {-# LANGUAGE FlexibleContexts #-} (because GHC checks inferred types
           now, in addition to explicitly given type signatures)

Also silenced warnings about tab characters in source files.
2015-02-16 15:05:06 +00:00
hallgren 3bfcfa157d Renaming SourceGrammar to Grammar and similarly for some related types
Included renamings:

	SourceGrammar -> Grammar
	SourceModule -> Module
	SourceModInfo -> ModuleInfo
	emptySourceGrammar -> emptyGrammar

Also introduces a type synonym (which might be good to turn into a newtype):

	type ModuleName = Ident

The reason is to make types like the following more self documenting:

	type Module = (ModuleName,ModuleInfo)
	type QIdent = (ModuleName,Ident)
2014-10-21 14:42:31 +00:00
hallgren c924491289 More haddock documentation improvements 2014-10-16 14:03:57 +00:00
hallgren 30cda51516 Introducing GF.Text.Pretty for more concise pretty printers and GF.Infra.Location for modularity
GF.Text.Pretty provides the class Pretty and overloaded versions of the pretty
printing combinators in Text.PrettyPrint, allowing pretty printable values to
be used directly instead of first having to convert them to Doc with functions
like text, int, char and ppIdent. Some modules have been converted to use
GF.Text.Pretty, but not all. Precedences could be added to simplify the pretty
printers for terms and patterns.

GF.Infra.Location contains the types Location and L, factored out from
GF.Grammar.Grammar, and the class HasSourcePath. This allowed the import
of GF.Grammar.Grammar to be removed from GF.Infra.CheckM, making it more
like a pure library module.
2014-07-27 22:06:23 +00:00
hallgren d6252d1c16 PGF library: expose only PGF and PGF.Internal instead of all modules
PGF exports the public, stable API.
PGF.Internal exports additional things needed in the GF compiler & shell,
including the nonstardard version of Data.Binary.
2014-06-12 14:43:18 +00:00
aarne 2aa8ad7e76 new overload resolution, taking care of ad hoc overloading. 2014-02-01 13:17:52 +00:00
kr.angelov 2483dc7728 the content of ParseEngAbs3.probs is now merged with ParseEngAbs.probs. The later is now retrained. Once the grammar is compiled with the .probs file now it doesn't need anything more to do robust parsing. The robustness itself is controlled by the flags 'heuristic_search_factor', 'meta_prob' and 'meta_token_prob' in ParseEngAbs.gf 2013-11-06 10:21:46 +00:00
hallgren 3814841d7d Eliminate mutual dependencies between the GF compiler and the PGF library
+ 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%.
2013-11-05 13:11:10 +00:00
kr.angelov 042243f08a added the linref construction in GF. The PGF version number is now bumped 2013-10-30 12:53:36 +00:00
hallgren 0feb386691 Faster regular expression pattern matching in the grammar compiler.
The sequence operator (x+y) was implemented by splitting the string to be
matched at all positions and trying to match the parts against the two
subpatterns. To reduce the number of splits, we now estimate the minimum and
maximum length of the string that the subpatterns could match. For common
cases, where one of the subpatterns is a string of known length, like
in (x+"y") or (x + ("a"|"o"|"u"|"e")+"y"), only one split will be tried.
2013-02-27 20:59:43 +00:00
hallgren 95c4cbb8f5 GF grammar pretty printer improvements
Allow line breaks in more places to make large terms more readable.
2013-02-27 14:22:47 +00:00
hallgren 53858fbc81 Fix a prededence bug in GF grammar pretty printer
The pretty printer produced

	mkDet pre {"a"; "an" / vowel} Sg

which is not accepted by the parser. The parser assigns pre { ... }, to
prededence level 4, and this is now reflected in the pretty printer, so
it prints

	mkDet (pre {"a"; "an" / vowel}) Sg

(This caused a problem in GFSE since it parsers pretty printed grammars...)
2012-11-23 18:44:08 +00:00
aarne 3dc2e55949 printing ResValue judgements as comments, to provide useful information when a conflict is found between parameter constructors 2012-06-25 09:24:04 +00:00
hallgren 9ebc423004 gfse: experimental support for editing concrete syntax in text mode 2012-02-22 16:30:42 +00:00
kr.angelov fffc5f2507 Sketch of the new type checker for the concrete syntax. Enabled only with -new-comp 2011-11-29 12:12:51 +00:00
kr.angelov 8a10aa5cf9 now the pretty printer in GF has a new mode called Internal. This is the most detailed mode and it can print even things that are not in the GF syntax. For example PMCFG snippets and indirections. 2011-11-15 15:55:45 +00:00
kr.angelov 416d231c5e Now PMCFG is compiled per module and at the end we only link it. The new compilation schema is few times faster. 2011-11-10 14:09:41 +00:00
kr.angelov 734c66710e merge GF.Infra.Modules and GF.Grammar.Grammar. This is a preparation for the separate PGF building 2011-11-02 13:57:11 +00:00
kr.angelov 5fe49ed9f7 Now the compiler maintains more precise information for the source locations of the different definitions. There is a --tags option which generates a list of all identifiers with their source locations. 2011-11-02 11:44:59 +00:00
hallgren ed451653bd Introduce an explicit error value in the Term type
This makes it easier to treat run-time errors (e.g. caused by calls to
Predef.error) in a way that is more typical for a lazy functional language.
2011-10-20 14:36:30 +00:00
kr.angelov bb599029c9 change the precedence for the left argument of -> 2011-09-22 16:24:02 +00:00
aarne 33a42b1c7c module for analysing source grammars 2011-09-20 16:00:56 +00:00
aarne a2ccf1ce69 command ss to show source (including gfo) in text; to be extended 2011-09-20 14:58:27 +00:00
aarne 7361ddea45 make it possible to override opers defined in an interface by syntax 'instance Foo of Bar - [f,g,h]' 2011-03-12 11:24:14 +00:00
krasimir 115b4213d5 operations in the abstract syntax 2010-11-12 19:37:19 +00:00
krasimir e94a1c7408 GF.Grammar.Printer: print expressions with lincat and lin 2010-06-21 15:23:49 +00:00
krasimir 992a7ffb38 Yay!! Direct generation of PMCFG from GF grammar 2010-06-18 12:55:58 +00:00
krasimir e8428b3d67 revert change in GF.Grammar.Printer that was intended for debugging only 2010-06-08 09:53:13 +00:00
krasimir c3f4c3eba7 refactoring in GF.Grammar.Grammar 2010-05-28 14:15:15 +00:00
krasimir ee6fdbf68f bugfix in GF.Grammar.Printer 2010-05-28 09:43:58 +00:00
aarne 5dfda62ad1 fixed a deep bug in TypeCheck due to swap of arguments; print empty record as <> instead of {} to distinguish from empty record type 2010-03-31 22:05:12 +00:00
krasimir bf74f50733 store and propagate the exact source location for all judgements in the grammar. It may not be used accurately in the error messages yet 2010-03-22 21:15:29 +00:00
krasimir 985bb550c0 fix the precedence for patterns ~, - and @ 2010-03-18 19:52:45 +00:00
krasimir f870c4d80f syntax for inaccessible patterns in GF 2010-03-18 19:34:30 +00:00
krasimir 21b10f91cb rule for pretty printing implicit arguments 2010-02-22 20:09:28 +00:00
krasimir d2988814a8 add pretty printing rule for implicit patterns 2010-02-22 20:02:53 +00:00
krasimir 19b17dceb6 no need to keep the list of constructors per category in .gfo 2010-02-16 09:34:02 +00:00
krasimir b90e56a94e fix the tabular printing when there is a V constructor 2010-02-03 17:33:55 +00:00
krasimir be6465a2eb refactor GF.Infra.Modules for better error messages 2010-01-31 15:54:25 +00:00
krasimir f85232947e reorganize the directories under src, and rescue the JavaScript interpreter from deprecated 2009-12-13 18:50:29 +00:00