From 83483b93bac1dd63bc2d8c52341aa0a8bfbb267e Mon Sep 17 00:00:00 2001 From: aarneranta Date: Mon, 3 Oct 2022 17:04:29 +0200 Subject: [PATCH 001/162] New construct: table update. Syntax t ** { cases }. Syntactic sugar for table {cases ; vvv => t \! vvv}.t --- src/compiler/GF/Grammar/Parser.y | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/GF/Grammar/Parser.y b/src/compiler/GF/Grammar/Parser.y index da96f9265..7837ec015 100644 --- a/src/compiler/GF/Grammar/Parser.y +++ b/src/compiler/GF/Grammar/Parser.y @@ -430,6 +430,7 @@ Exp3 RecType xs -> RecType (xs ++ [(tupleLabel (length xs+1),$3)]) t -> RecType [(tupleLabel 1,$1), (tupleLabel 2,$3)] } | Exp3 '**' Exp4 { ExtR $1 $3 } + | Exp3 '**' '{' ListCase '}' { let v = identS "vvv" in T TRaw ($4 ++ [(PV v, S $1 (Vr v))]) } | Exp4 { $1 } Exp4 :: { Term } From 223f92d4f67bc4a168409b20e019b0ec6ad4b904 Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Tue, 4 Oct 2022 11:06:56 +0200 Subject: [PATCH 002/162] using an unparsable variable name in the internal desugaring of table extension to avoid captures; captures with iterated table extensions might still be possible, which needs further analysis --- src/compiler/GF/Grammar/Parser.y | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/GF/Grammar/Parser.y b/src/compiler/GF/Grammar/Parser.y index 7837ec015..85b081cd7 100644 --- a/src/compiler/GF/Grammar/Parser.y +++ b/src/compiler/GF/Grammar/Parser.y @@ -430,7 +430,7 @@ Exp3 RecType xs -> RecType (xs ++ [(tupleLabel (length xs+1),$3)]) t -> RecType [(tupleLabel 1,$1), (tupleLabel 2,$3)] } | Exp3 '**' Exp4 { ExtR $1 $3 } - | Exp3 '**' '{' ListCase '}' { let v = identS "vvv" in T TRaw ($4 ++ [(PV v, S $1 (Vr v))]) } + | Exp3 '**' '{' ListCase '}' { let v = identS "$vvv" in T TRaw ($4 ++ [(PV v, S $1 (Vr v))]) } | Exp4 { $1 } Exp4 :: { Term } From fef03e755b5ba1d1d34e001e09b1968323f89324 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Tue, 4 Oct 2022 13:06:43 +0200 Subject: [PATCH 003/162] Update some old unused code to support newer ghc --- src/tools/c/GFCC/ErrM.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/tools/c/GFCC/ErrM.hs b/src/tools/c/GFCC/ErrM.hs index 78295d30e..872a8aec0 100644 --- a/src/tools/c/GFCC/ErrM.hs +++ b/src/tools/c/GFCC/ErrM.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE CPP #-} +{-# LANGUAGE DeriveFunctor #-} -- BNF Converter: Error Monad -- Copyright (C) 2004 Author: Aarne Ranta @@ -6,12 +8,17 @@ module GFCC.ErrM where -- Control.Monad.Fail import will become redundant in GHC 8.8+ import qualified Control.Monad.Fail as Fail +import Control.Monad (ap) -- the Error monad: like Maybe type with error msgs data Err a = Ok a | Bad String - deriving (Read, Show, Eq) + deriving (Read, Show, Eq, Functor) + +instance Applicative Err where + pure = Ok + (<*>) = ap instance Monad Err where return = Ok From 51b7117a3d0ae56118074112203d1f3f18402d0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Tue, 4 Oct 2022 13:05:57 +0200 Subject: [PATCH 004/162] Restore build with ghc-7.10.3 --- gf.cabal | 4 +++- src/compiler/GF/Interactive.hs | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gf.cabal b/gf.cabal index da54010d1..3c3687de2 100644 --- a/gf.cabal +++ b/gf.cabal @@ -81,7 +81,9 @@ library mtl >= 2.2.1 && < 2.3, pretty >= 1.1.3 && < 1.2, random >= 1.1 && < 1.3, - utf8-string >= 1.0.1.1 && < 1.1 + utf8-string >= 1.0.1.1 && < 1.1, + -- We need this in order for ghc-7.10 to build + transformers-compat >= 0.6.3 && < 0.7 if impl(ghc<8.0) build-depends: diff --git a/src/compiler/GF/Interactive.hs b/src/compiler/GF/Interactive.hs index 676511680..a3a02af78 100644 --- a/src/compiler/GF/Interactive.hs +++ b/src/compiler/GF/Interactive.hs @@ -38,6 +38,8 @@ import GF.Server(server) #endif import GF.Command.Messages(welcome) +-- Needed to make it compile on GHC < 8 +import Control.Monad.Trans.Instances () -- | Run the GF Shell in quiet mode (@gf -run@). mainRunGFI :: Options -> [FilePath] -> IO () From 0a16b76875fa8d99c81a4e840083faff771b3cda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Tue, 4 Oct 2022 13:28:06 +0200 Subject: [PATCH 005/162] Only include transformers-compat for ghc < 8 Since that's the only place where it's needed and we don't have to fight with versions elsewhere --- gf.cabal | 6 +++--- src/compiler/GF/Interactive.hs | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gf.cabal b/gf.cabal index 3c3687de2..022cc1e21 100644 --- a/gf.cabal +++ b/gf.cabal @@ -81,12 +81,12 @@ library mtl >= 2.2.1 && < 2.3, pretty >= 1.1.3 && < 1.2, random >= 1.1 && < 1.3, - utf8-string >= 1.0.1.1 && < 1.1, - -- We need this in order for ghc-7.10 to build - transformers-compat >= 0.6.3 && < 0.7 + utf8-string >= 1.0.1.1 && < 1.1 if impl(ghc<8.0) build-depends: + -- We need this in order for ghc-7.10 to build + transformers-compat >= 0.6.3 && < 0.7, fail >= 4.9.0 && < 4.10 hs-source-dirs: src/runtime/haskell diff --git a/src/compiler/GF/Interactive.hs b/src/compiler/GF/Interactive.hs index a3a02af78..1970533d6 100644 --- a/src/compiler/GF/Interactive.hs +++ b/src/compiler/GF/Interactive.hs @@ -38,8 +38,10 @@ import GF.Server(server) #endif import GF.Command.Messages(welcome) +#if !(MIN_VERSION_base(4,9,0)) -- Needed to make it compile on GHC < 8 import Control.Monad.Trans.Instances () +#endif -- | Run the GF Shell in quiet mode (@gf -run@). mainRunGFI :: Options -> [FilePath] -> IO () From 03df25bb7ac2f57a5382cda44dbaef8170543758 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Tue, 4 Oct 2022 16:46:36 +0200 Subject: [PATCH 006/162] Add support for ghc-9.2.4 --- gf.cabal | 8 ++++---- src/runtime/haskell/Data/Binary/Builder.hs | 9 +++++++++ src/runtime/haskell/Data/Binary/Get.hs | 8 ++++++++ stack-ghc9.2.4.yaml | 7 +++++++ 4 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 stack-ghc9.2.4.yaml diff --git a/gf.cabal b/gf.cabal index 022cc1e21..21093ae0b 100644 --- a/gf.cabal +++ b/gf.cabal @@ -11,7 +11,7 @@ description: GF, Grammatical Framework, is a programming language for multilingu maintainer: John J. Camilleri homepage: https://www.grammaticalframework.org/ bug-reports: https://github.com/GrammaticalFramework/gf-core/issues -tested-with: GHC==7.10.3, GHC==8.0.2, GHC==8.10.4, GHC==9.0.2 +tested-with: GHC==7.10.3, GHC==8.0.2, GHC==8.10.4, GHC==9.0.2, GHC==9.2.4 data-dir: src extra-source-files: @@ -73,11 +73,11 @@ library build-depends: -- GHC 8.0.2 to GHC 8.10.4 array >= 0.5.1 && < 0.6, - base >= 4.9.1 && < 4.16, - bytestring >= 0.10.8 && < 0.11, + base >= 4.9.1 && < 4.17, + bytestring >= 0.10.8 && < 0.12, containers >= 0.5.7 && < 0.7, exceptions >= 0.8.3 && < 0.11, - ghc-prim >= 0.5.0 && < 0.7.1, + ghc-prim >= 0.5.0 && < 0.9.0, mtl >= 2.2.1 && < 2.3, pretty >= 1.1.3 && < 1.2, random >= 1.1 && < 1.3, diff --git a/src/runtime/haskell/Data/Binary/Builder.hs b/src/runtime/haskell/Data/Binary/Builder.hs index a74428f20..5f8983c0c 100644 --- a/src/runtime/haskell/Data/Binary/Builder.hs +++ b/src/runtime/haskell/Data/Binary/Builder.hs @@ -77,6 +77,9 @@ import qualified Data.ByteString.Internal as S import GHC.Base(Int(..),uncheckedShiftRL# ) import GHC.Word (Word32(..),Word16(..),Word64(..)) +#if MIN_VERSION_base(4,16,0) +import GHC.Exts (wordToWord16#, word16ToWord#, wordToWord32#, word32ToWord#) +#endif #if WORD_SIZE_IN_BITS < 64 && __GLASGOW_HASKELL__ >= 608 import GHC.Word (uncheckedShiftRL64#) #endif @@ -411,8 +414,14 @@ shiftr_w32 :: Word32 -> Int -> Word32 shiftr_w64 :: Word64 -> Int -> Word64 #if defined(__GLASGOW_HASKELL__) && !defined(__HADDOCK__) +#if MIN_VERSION_base(4,16,0) +shiftr_w16 (W16# w) (I# i) = W16# (wordToWord16# ((word16ToWord# w) `uncheckedShiftRL#` i)) +shiftr_w32 (W32# w) (I# i) = W32# (wordToWord32# ((word32ToWord# w) `uncheckedShiftRL#` i)) +#else shiftr_w16 (W16# w) (I# i) = W16# (w `uncheckedShiftRL#` i) shiftr_w32 (W32# w) (I# i) = W32# (w `uncheckedShiftRL#` i) +#endif + #if WORD_SIZE_IN_BITS < 64 shiftr_w64 (W64# w) (I# i) = W64# (w `uncheckedShiftRL64#` i) diff --git a/src/runtime/haskell/Data/Binary/Get.hs b/src/runtime/haskell/Data/Binary/Get.hs index 895789061..8faf249a9 100644 --- a/src/runtime/haskell/Data/Binary/Get.hs +++ b/src/runtime/haskell/Data/Binary/Get.hs @@ -101,6 +101,9 @@ import Data.STRef import GHC.Base import GHC.Word --import GHC.Int +#if MIN_VERSION_base(4,16,0) +import GHC.Exts (wordToWord16#, word16ToWord#, wordToWord32#, word32ToWord#) +#endif #endif -- Control.Monad.Fail import will become redundant in GHC 8.8+ @@ -532,8 +535,13 @@ shiftl_w32 :: Word32 -> Int -> Word32 shiftl_w64 :: Word64 -> Int -> Word64 #if defined(__GLASGOW_HASKELL__) && !defined(__HADDOCK__) +#if MIN_VERSION_base(4,16,0) +shiftl_w16 (W16# w) (I# i) = W16# (wordToWord16# ((word16ToWord# w) `uncheckedShiftL#` i)) +shiftl_w32 (W32# w) (I# i) = W32# (wordToWord32# ((word32ToWord# w) `uncheckedShiftL#` i)) +#else shiftl_w16 (W16# w) (I# i) = W16# (w `uncheckedShiftL#` i) shiftl_w32 (W32# w) (I# i) = W32# (w `uncheckedShiftL#` i) +#endif #if WORD_SIZE_IN_BITS < 64 shiftl_w64 (W64# w) (I# i) = W64# (w `uncheckedShiftL64#` i) diff --git a/stack-ghc9.2.4.yaml b/stack-ghc9.2.4.yaml new file mode 100644 index 000000000..3758d56ad --- /dev/null +++ b/stack-ghc9.2.4.yaml @@ -0,0 +1,7 @@ +resolver: nightly-2022-09-30 # GHC-9.2.4 + +extra-deps: +- multipart-0.2.0@sha256:b8770e3ff6089be4dd089a8250894b31287cca671f3d258190a505f9351fa8a9,1084 +- cgi-3001.5.0.0@sha256:3d1193a328d5f627a021a0ef3927c1ae41dd341e32dba612fed52d0e3a6df056,2990 + +allow-newer: true From fef7b80d8e988f6ad8de720a9e3a1098bc5f8a3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Sun, 2 Oct 2022 21:49:56 +0200 Subject: [PATCH 007/162] Use a Set in isInherited to speed up long extend lists 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, ... ]; --- src/compiler/GF/Grammar/Grammar.hs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/compiler/GF/Grammar/Grammar.hs b/src/compiler/GF/Grammar/Grammar.hs index 587b09a9f..8b88561d2 100644 --- a/src/compiler/GF/Grammar/Grammar.hs +++ b/src/compiler/GF/Grammar/Grammar.hs @@ -78,6 +78,7 @@ import PGF.Internal (FId, FunId, SeqId, LIndex, Sequence, BindType(..)) import Data.Array.IArray(Array) import Data.Array.Unboxed(UArray) import qualified Data.Map as Map +import qualified Data.Set as Set import GF.Text.Pretty @@ -125,10 +126,12 @@ extends :: ModuleInfo -> [ModuleName] extends = map fst . mextend isInherited :: MInclude -> Ident -> Bool -isInherited c i = case c of - MIAll -> True - MIOnly is -> elem i is - MIExcept is -> notElem i is +isInherited c = + case c of + MIAll -> const True + MIOnly is -> let is' = Set.fromList is in (`Set.member` is') + MIExcept is -> let is' = Set.fromList is in (`Set.notMember` is') + inheritAll :: ModuleName -> (ModuleName,MInclude) inheritAll i = (i,MIAll) From a58c6d49d4b5d5cf750c36c9071279fccd9c468f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Sun, 2 Oct 2022 21:57:11 +0200 Subject: [PATCH 008/162] Extract the previous optimization to its own function --- src/compiler/GF/Grammar/Grammar.hs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/compiler/GF/Grammar/Grammar.hs b/src/compiler/GF/Grammar/Grammar.hs index 8b88561d2..448fa1657 100644 --- a/src/compiler/GF/Grammar/Grammar.hs +++ b/src/compiler/GF/Grammar/Grammar.hs @@ -129,9 +129,17 @@ isInherited :: MInclude -> Ident -> Bool isInherited c = case c of MIAll -> const True - MIOnly is -> let is' = Set.fromList is in (`Set.member` is') - MIExcept is -> let is' = Set.fromList is in (`Set.notMember` is') + MIOnly is -> elemOrd is + MIExcept is -> not . elemOrd is +-- | Faster version of `elem`, using a `Set`. +-- Make sure you give this the first argument _outside_ of the inner loop +-- +-- Example: +-- > myIntersection xs ys = filter (elemOrd xs) ys +elemOrd :: Ord a => [a] -> a -> Bool +elemOrd list = (`Set.member` set) + where set = Set.fromList list inheritAll :: ModuleName -> (ModuleName,MInclude) inheritAll i = (i,MIAll) From 7bcc70e79daad9efef63a7803c37a22050ef9ff1 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 24 Jan 2023 16:19:22 +0800 Subject: [PATCH 009/162] Summer school 2023 --- index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 0b9090ee7..6832b2f52 100644 --- a/index.html +++ b/index.html @@ -254,6 +254,10 @@ least one, it may help you to get a first idea of what GF is.

News

+
2023-01-24
+
+ 8th GF Summer School, in Tampere, Finland, 14 – 25 August 2023. +
2021-07-25
GF 3.11 released. @@ -263,10 +267,6 @@ least one, it may help you to get a first idea of what GF is.
GF WordNet now supports languages for which there are no other WordNets. New additions: Afrikaans, German, Korean, Maltese, Polish, Somali, Swahili.
-
2021-03-01
-
- Seventh GF Summer School, in Singapore and online, 26 July – 6 August 2021. -
2020-09-29
Abstract Syntax as Interlingua: Scaling Up the Grammatical Framework from Controlled Languages to Robust Pipelines. A paper in Computational Linguistics (2020) summarizing much of the development in GF in the past ten years. From 8b82f1ab33afbcf3268e78292be1e9c370cb35f1 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 24 Jan 2023 16:33:28 +0800 Subject: [PATCH 010/162] remove 2020-specific link --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 6832b2f52..dd252ec94 100644 --- a/index.html +++ b/index.html @@ -105,7 +105,7 @@
  • Mailing List
  • Issue Tracker
  • -
  • Summer School
  • +
  • Summer School
  • Authors
  • From 2c13f529f981be8380e2ea869408c5c59436d049 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Sun, 5 Feb 2023 09:40:14 +0100 Subject: [PATCH 011/162] Update INSTALL --- src/runtime/c/INSTALL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/c/INSTALL b/src/runtime/c/INSTALL index c45c18fa9..f7850c5b7 100644 --- a/src/runtime/c/INSTALL +++ b/src/runtime/c/INSTALL @@ -44,7 +44,7 @@ $ make install For Windows users ----------------- -- Install MinGW: http://www.mingw.org/. From the installer you need +- Install MinGW: http://www.mingw-w64.org/. From the installer you need to select at least the following packages: - Mingw-developer-toolkit - Mingw-base From 527a4451d3aebaafbdf43401fca7ecf9b3a8c259 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 10 Feb 2023 10:46:10 +0800 Subject: [PATCH 012/162] update to System.Environment (getArgs) --- doc/tutorial/gf-tutorial.t2t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/tutorial/gf-tutorial.t2t b/doc/tutorial/gf-tutorial.t2t index 63407a38a..2c8d909de 100644 --- a/doc/tutorial/gf-tutorial.t2t +++ b/doc/tutorial/gf-tutorial.t2t @@ -4578,7 +4578,7 @@ in any multilingual grammar between any languages in the grammar. module Main where import PGF -import System (getArgs) +import System.Environment (getArgs) main :: IO () main = do From 8190d9fe497df770ac9f294e0b45a5f01c09d62e Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 1 Mar 2023 09:57:48 +0100 Subject: [PATCH 013/162] export BindType(..) --- src/runtime/haskell/PGF.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/haskell/PGF.hs b/src/runtime/haskell/PGF.hs index a432aa9bb..1138c9634 100644 --- a/src/runtime/haskell/PGF.hs +++ b/src/runtime/haskell/PGF.hs @@ -31,7 +31,7 @@ module PGF( languages, abstractName, languageCode, -- * Types - Type, Hypo, + Type, Hypo, BindType(..), showType, readType, mkType, mkHypo, mkDepHypo, mkImplHypo, unType, From 6a36b486fae612798ec36873ccbbdbca73df4f6c Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 3 Mar 2023 01:17:28 +0100 Subject: [PATCH 014/162] Update instructions for Geany --- doc/gf-editor-modes.t2t | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/gf-editor-modes.t2t b/doc/gf-editor-modes.t2t index 2e92f31c3..4ff15520d 100644 --- a/doc/gf-editor-modes.t2t +++ b/doc/gf-editor-modes.t2t @@ -59,8 +59,10 @@ By John J. Camilleri [Custom filetype http://www.geany.org/manual/dev/index.html#custom-filetypes] config files for syntax highlighting in [Geany http://www.geany.org/]. -Copy one of the files below to ``/usr/share/geany/filetypes.GF.conf`` -(under Ubuntu). You will need to manually create the file. +For version 1.36 and above, copy one of the files below to +``/usr/share/geany/filedefs/filetypes.GF.conf`` (under Ubuntu). +If you're using a version older than 1.36, copy the file to ``/usr/share/geany/filetypes.GF.conf``. +You will need to manually create the file. - [light-filetypes.GF.conf ../src/tools/light-filetypes.GF.conf] - [dark-filetypes.GF.conf ../src/tools/dark-filetypes.GF.conf] From 8f6dc916b60611d30bd3ed50e1862087a019ff06 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Fri, 4 Aug 2023 14:46:27 +0200 Subject: [PATCH 015/162] added aarch64 configure.ac --- src/runtime/c/configure.ac | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/runtime/c/configure.ac b/src/runtime/c/configure.ac index d8e55c164..2af669fe2 100644 --- a/src/runtime/c/configure.ac +++ b/src/runtime/c/configure.ac @@ -43,8 +43,10 @@ case "$target_cpu" in [Define if lightning is targeting the sparc architecture]) ;; powerpc) cpu=ppc; AC_DEFINE(LIGHTNING_PPC, 1, [Define if lightning is targeting the powerpc architecture]) ;; - arm*) cpu=arm; AC_DEFINE(LIGHTNING_ARM, 1, + arm*) cpu=arm; AC_DEFINE(LIGHTNING_ARM, 1, [Define if lightning is targeting the arm architecture]) ;; + aarch64) cpu=aarch64; AC_DEFINE(LIGHTNING_AARCH64, 1, + [Define if lightning is targeting the aarch64 architecture]) ;; *) AC_MSG_ERROR([cpu $target_cpu not supported]) ;; esac From f58697f31f3a5346d4e4bf0d54eb7e6fa814b58a Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Fri, 4 Aug 2023 14:48:01 +0200 Subject: [PATCH 016/162] Create aarch64/asm.h --- src/runtime/c/pgf/lightning/aarch64/asm.h | 1 + 1 file changed, 1 insertion(+) create mode 100644 src/runtime/c/pgf/lightning/aarch64/asm.h diff --git a/src/runtime/c/pgf/lightning/aarch64/asm.h b/src/runtime/c/pgf/lightning/aarch64/asm.h new file mode 100644 index 000000000..ed1b80139 --- /dev/null +++ b/src/runtime/c/pgf/lightning/aarch64/asm.h @@ -0,0 +1 @@ +// DUMMY From 83a4a0525e4c08b9f5990eedb3abcb9a2179234a Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Fri, 4 Aug 2023 14:48:58 +0200 Subject: [PATCH 017/162] Create aarch64/core.h --- src/runtime/c/pgf/lightning/aarch64/core.h | 1 + 1 file changed, 1 insertion(+) create mode 100644 src/runtime/c/pgf/lightning/aarch64/core.h diff --git a/src/runtime/c/pgf/lightning/aarch64/core.h b/src/runtime/c/pgf/lightning/aarch64/core.h new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/src/runtime/c/pgf/lightning/aarch64/core.h @@ -0,0 +1 @@ + From 9dee033e2c968733edc795305e83c7c38bda3b35 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Fri, 4 Aug 2023 14:49:22 +0200 Subject: [PATCH 018/162] Create Create aarch64/fp.h --- src/runtime/c/pgf/lightning/aarch64/fp.h | 1 + 1 file changed, 1 insertion(+) create mode 100644 src/runtime/c/pgf/lightning/aarch64/fp.h diff --git a/src/runtime/c/pgf/lightning/aarch64/fp.h b/src/runtime/c/pgf/lightning/aarch64/fp.h new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/src/runtime/c/pgf/lightning/aarch64/fp.h @@ -0,0 +1 @@ + From 95e5976b03c156c32acf3cde67a60591cc3713aa Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Fri, 4 Aug 2023 14:49:55 +0200 Subject: [PATCH 019/162] Create funcs.h --- src/runtime/c/pgf/lightning/aarch64/funcs.h | 1 + 1 file changed, 1 insertion(+) create mode 100644 src/runtime/c/pgf/lightning/aarch64/funcs.h diff --git a/src/runtime/c/pgf/lightning/aarch64/funcs.h b/src/runtime/c/pgf/lightning/aarch64/funcs.h new file mode 100644 index 000000000..ed1b80139 --- /dev/null +++ b/src/runtime/c/pgf/lightning/aarch64/funcs.h @@ -0,0 +1 @@ +// DUMMY From 0e1cbfaa7e5d87d5b44410e8b8d41d0a21cecb72 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Fri, 4 Aug 2023 15:01:31 +0200 Subject: [PATCH 020/162] Disable the jit on aarch64 --- src/runtime/c/pgf/jit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/c/pgf/jit.c b/src/runtime/c/pgf/jit.c index 0d5fa9dc6..2e0145a24 100644 --- a/src/runtime/c/pgf/jit.c +++ b/src/runtime/c/pgf/jit.c @@ -8,7 +8,7 @@ //#define PGF_JIT_DEBUG -#ifdef EMSCRIPTEN +#if defined(EMSCRIPTEN) || defined(LIGHTNING_AARCH64) PGF_INTERNAL PgfJitState* pgf_new_jit(PgfReader* rdr) From 5131fadd1f622436314c6059cf2d7b3f64eb5d89 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Tue, 8 Aug 2023 16:18:49 +0200 Subject: [PATCH 021/162] lightning.h not included on aarch64 --- src/runtime/c/pgf/jit.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/runtime/c/pgf/jit.c b/src/runtime/c/pgf/jit.c index 2e0145a24..77ff24e99 100644 --- a/src/runtime/c/pgf/jit.c +++ b/src/runtime/c/pgf/jit.c @@ -4,7 +4,10 @@ #include #include #include + +#if !defined(LIGHTNING_AARCH64) #include "lightning.h" +#endif //#define PGF_JIT_DEBUG From fae2fc4c6c371d84e88633e5fbf1f71451272a5e Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Aug 2023 10:58:50 +0200 Subject: [PATCH 022/162] Try with __aarch64__ --- src/runtime/c/pgf/jit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/c/pgf/jit.c b/src/runtime/c/pgf/jit.c index 77ff24e99..a4d2c3ec6 100644 --- a/src/runtime/c/pgf/jit.c +++ b/src/runtime/c/pgf/jit.c @@ -5,7 +5,7 @@ #include #include -#if !defined(LIGHTNING_AARCH64) +#if !defined(__aarch64__) #include "lightning.h" #endif From e2c2763d5931d7d214078d5594a5aa7e9a531ae1 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Aug 2023 10:59:53 +0200 Subject: [PATCH 023/162] One more place with __aarch64__ --- src/runtime/c/pgf/jit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/c/pgf/jit.c b/src/runtime/c/pgf/jit.c index a4d2c3ec6..b5de73176 100644 --- a/src/runtime/c/pgf/jit.c +++ b/src/runtime/c/pgf/jit.c @@ -11,7 +11,7 @@ //#define PGF_JIT_DEBUG -#if defined(EMSCRIPTEN) || defined(LIGHTNING_AARCH64) +#if defined(EMSCRIPTEN) || defined(__aarch64__) PGF_INTERNAL PgfJitState* pgf_new_jit(PgfReader* rdr) From 86af7b12b3f9f9f712ddcf19973cfb1a80042aa9 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Fri, 11 Aug 2023 10:47:29 +0200 Subject: [PATCH 024/162] the jitter should still read the absfuns even for EMSCRIPTEN and aarch64 --- src/runtime/c/pgf/jit.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/runtime/c/pgf/jit.c b/src/runtime/c/pgf/jit.c index b5de73176..5912dfea5 100644 --- a/src/runtime/c/pgf/jit.c +++ b/src/runtime/c/pgf/jit.c @@ -29,6 +29,14 @@ PGF_INTERNAL void pgf_jit_predicate(PgfReader* rdr, PgfAbstr* abstr, PgfAbsCat* abscat) { + size_t n_funs = pgf_read_len(rdr); + gu_return_on_exn(rdr->err, ); + + for (size_t i = 0; i < n_funs; i++) { + gu_in_f64be(rdr->in, rdr->err); // ignore + gu_return_on_exn(rdr->err,); + pgf_read_cid(rdr, rdr->tmp_pool); + } } PGF_INTERNAL void From 096b36c21d9657d1dee93638b436dc7bb35af439 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Thu, 7 Sep 2023 17:37:25 +0200 Subject: [PATCH 025/162] Update jit.c --- src/runtime/c/pgf/jit.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/runtime/c/pgf/jit.c b/src/runtime/c/pgf/jit.c index 5912dfea5..4aa489560 100644 --- a/src/runtime/c/pgf/jit.c +++ b/src/runtime/c/pgf/jit.c @@ -22,7 +22,9 @@ pgf_new_jit(PgfReader* rdr) PGF_INTERNAL PgfEvalGates* pgf_jit_gates(PgfReader* rdr) { - return NULL; + PgfEvalGates* gates = gu_new(PgfEvalGates, rdr->opool); + memset(gates, 0, sizeof(*gates)); + return gates; } PGF_INTERNAL void From ffd7b27abd050dc50f5986c9b94f8fb5d120c2db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Mon, 11 Sep 2023 12:29:13 +0200 Subject: [PATCH 026/162] Improve syntax error messages Now you will get error messages like these: example.gf:1:21: Syntax error: Unexpected token '}'. Expected one of: - '{' - 'open' - an identifier --- src/compiler/GF/Grammar/Lexer.x | 11 +++++++++-- src/compiler/GF/Grammar/Parser.y | 17 +++++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/compiler/GF/Grammar/Lexer.x b/src/compiler/GF/Grammar/Lexer.x index 365388726..b3d271ddd 100644 --- a/src/compiler/GF/Grammar/Lexer.x +++ b/src/compiler/GF/Grammar/Lexer.x @@ -4,7 +4,7 @@ module GF.Grammar.Lexer ( Token(..), Posn(..) , P, runP, runPartial, token, lexer, getPosn, failLoc - , isReservedWord + , isReservedWord, invMap ) where import Control.Applicative @@ -134,7 +134,7 @@ data Token | T_Double Double -- double precision float literals | T_Ident Ident | T_EOF --- deriving Show -- debug + deriving (Eq, Ord, Show) -- debug res = eitherResIdent eitherResIdent :: (Ident -> Token) -> Ident -> Token @@ -224,6 +224,13 @@ resWords = Map.fromList ] where b s t = (identS s, t) +invMap :: Map.Map Token String +invMap = res + where + lst = Map.toList resWords + flp = map (\(k,v) -> (v,showIdent k)) lst + res = Map.fromList flp + unescapeInitTail :: String -> String unescapeInitTail = unesc . tail where unesc s = case s of diff --git a/src/compiler/GF/Grammar/Parser.y b/src/compiler/GF/Grammar/Parser.y index 85b081cd7..6aedcd399 100644 --- a/src/compiler/GF/Grammar/Parser.y +++ b/src/compiler/GF/Grammar/Parser.y @@ -37,6 +37,9 @@ import PGF(mkCId) %name pBNFCRules ListCFRule %name pEBNFRules ListEBNFRule +%errorhandlertype explist +%error { happyError } + -- no lexer declaration %monad { P } { >>= } { return } %lexer { lexer } { T_EOF } @@ -702,8 +705,18 @@ Posn { -happyError :: P a -happyError = fail "syntax error" +happyError :: (Token, [String]) -> P a +happyError (t,strs) = fail $ + "Syntax error:\n Unexpected " ++ showToken t ++ ".\n Expected one of:\n" + ++ unlines (map ((" - "++).cleanupToken) strs) + + where + cleanupToken "Ident" = "an identifier" + cleanupToken x = x + showToken (T_Ident i) = "identifier '" ++ showIdent i ++ "'" + showToken t = case Map.lookup t invMap of + Nothing -> show t + Just s -> "token '" ++ s ++"'" mkListId,mkConsId,mkBaseId :: Ident -> Ident mkListId = prefixIdent "List" From 003ab57576c5f1fccb2a7e712bf342c771ab7fec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Mon, 11 Sep 2023 18:43:14 +0800 Subject: [PATCH 027/162] Bump version of haskell github action The old one was failing --- .github/workflows/build-all-versions.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-all-versions.yml b/.github/workflows/build-all-versions.yml index ecbcfff99..d7cac5ce4 100644 --- a/.github/workflows/build-all-versions.yml +++ b/.github/workflows/build-all-versions.yml @@ -33,7 +33,7 @@ jobs: - uses: actions/checkout@v2 if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master' - - uses: haskell/actions/setup@v1.2.9 + - uses: haskell/actions/setup@v2 id: setup-haskell-cabal name: Setup Haskell with: @@ -73,7 +73,7 @@ jobs: - uses: actions/checkout@v2 if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master' - - uses: haskell/actions/setup@v1.2.9 + - uses: haskell/actions/setup@v2 name: Setup Haskell Stack with: ghc-version: ${{ matrix.ghc }} From 88db715c3d93b15341b055469f6d470de9273616 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Mon, 11 Sep 2023 13:03:05 +0200 Subject: [PATCH 028/162] Fix ghc-7.10.3 build in gh-actions ghc-7.10.3 is not supported in the latest builder, so we need an older version of ubuntu for it to work --- .github/workflows/build-all-versions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-all-versions.yml b/.github/workflows/build-all-versions.yml index d7cac5ce4..eea778daa 100644 --- a/.github/workflows/build-all-versions.yml +++ b/.github/workflows/build-all-versions.yml @@ -62,7 +62,7 @@ jobs: stack: name: stack / ghc ${{ matrix.ghc }} - runs-on: ubuntu-latest + runs-on: ${{ matrix.ghc == '7.10.3' && 'ubuntu-2004' || 'ubuntu-latest' }} strategy: matrix: stack: ["latest"] From b90666455efd3b83345ad4b77eac4b64373e4c83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Mon, 11 Sep 2023 13:17:19 +0200 Subject: [PATCH 029/162] Fix typo --- .github/workflows/build-all-versions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-all-versions.yml b/.github/workflows/build-all-versions.yml index eea778daa..f6f1b82a7 100644 --- a/.github/workflows/build-all-versions.yml +++ b/.github/workflows/build-all-versions.yml @@ -62,7 +62,7 @@ jobs: stack: name: stack / ghc ${{ matrix.ghc }} - runs-on: ${{ matrix.ghc == '7.10.3' && 'ubuntu-2004' || 'ubuntu-latest' }} + runs-on: ${{ matrix.ghc == '7.10.3' && 'ubuntu-20.04' || 'ubuntu-latest' }} strategy: matrix: stack: ["latest"] From 268a25f59cd4790ef5896ddd237f0bc48f6fad26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Mon, 25 Sep 2023 09:53:59 +0200 Subject: [PATCH 030/162] Indent each line of an error message 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 --- src/compiler/GF/Compile/GetGrammar.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/GF/Compile/GetGrammar.hs b/src/compiler/GF/Compile/GetGrammar.hs index 191c3aff9..a7fd3de72 100644 --- a/src/compiler/GF/Compile/GetGrammar.hs +++ b/src/compiler/GF/Compile/GetGrammar.hs @@ -42,11 +42,12 @@ getSourceModule opts file0 = raw <- liftIO $ keepTemp tmp --ePutStrLn $ "1 "++file0 (optCoding,parsed) <- parseSource opts pModDef raw + let indentLines = unlines . map (" "++) . lines case parsed of Left (Pn l c,msg) -> do file <- liftIO $ writeTemp tmp cwd <- getCurrentDirectory let location = makeRelative cwd file++":"++show l++":"++show c - raise (location++":\n "++msg) + raise (location++":\n" ++ indentLines msg) Right (i,mi0) -> do liftIO $ removeTemp tmp let mi =mi0 {mflags=mflags mi0 `addOptions` opts, msrc=file0} From ea3cef46b0f86a87207e512e8413929567ba9c4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Mon, 25 Sep 2023 12:01:56 +0200 Subject: [PATCH 031/162] Update test to match new error --- testsuite/compiler/update/ArrityCheck.gfs.gold | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/testsuite/compiler/update/ArrityCheck.gfs.gold b/testsuite/compiler/update/ArrityCheck.gfs.gold index 7e0ff3d44..bfe3808ab 100644 --- a/testsuite/compiler/update/ArrityCheck.gfs.gold +++ b/testsuite/compiler/update/ArrityCheck.gfs.gold @@ -2,7 +2,8 @@ testsuite/compiler/update/ArrityCheck.gf:6:1: conflicting information in module ArrityCheck - fun f : Int -> Int -> Int ; - def f 0 = \x -> x ; -and - def f 1 1 = 0 ; + fun f : Int -> Int -> Int ; + def f 0 = \x -> x ; + and + def f 1 1 = 0 ; + From 30c13762329d406c4dc155d72767ee407ab590e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Mon, 25 Sep 2023 12:43:19 +0200 Subject: [PATCH 032/162] Don't build twice for tests in CI --- .github/workflows/build-all-versions.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build-all-versions.yml b/.github/workflows/build-all-versions.yml index f6f1b82a7..2bd856b7c 100644 --- a/.github/workflows/build-all-versions.yml +++ b/.github/workflows/build-all-versions.yml @@ -95,8 +95,7 @@ jobs: - name: Build run: | - stack build --system-ghc --stack-yaml stack-ghc${{ matrix.ghc }}.yaml - # stack build --system-ghc --test --bench --no-run-tests --no-run-benchmarks + stack build --test --no-run-tests --system-ghc --stack-yaml stack-ghc${{ matrix.ghc }}.yaml - name: Test run: | From 37f06a4ae845471009610d79d616eab0bdd903d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Mon, 25 Sep 2023 12:48:56 +0200 Subject: [PATCH 033/162] gh-actions: Don't use ubuntu-18 and macos-10.15 There are no longer any gihub actions runners available for these Note that this means we can't build for ubuntu-18 anymore, but that should hopefully no longer be relevant, since it's over 5 years old now. --- .github/workflows/build-binary-packages.yml | 2 +- .github/workflows/build-python-package.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-binary-packages.yml b/.github/workflows/build-binary-packages.yml index 493d5e774..d476aa161 100644 --- a/.github/workflows/build-binary-packages.yml +++ b/.github/workflows/build-binary-packages.yml @@ -14,8 +14,8 @@ jobs: strategy: matrix: os: - - ubuntu-18.04 - ubuntu-20.04 + - ubuntu-22.04 runs-on: ${{ matrix.os }} diff --git a/.github/workflows/build-python-package.yml b/.github/workflows/build-python-package.yml index 67cbba6dd..0f6e3c050 100644 --- a/.github/workflows/build-python-package.yml +++ b/.github/workflows/build-python-package.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: true matrix: - os: [ubuntu-18.04, macos-10.15] + os: [ubuntu-latest, macos-latest] steps: - uses: actions/checkout@v1 From cf1ef40789fc6761e46ecac1215cdb018972f2ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Mon, 25 Sep 2023 12:53:55 +0200 Subject: [PATCH 034/162] gh-actions: Bump the python version cibuildwheel requires python >= 3.8 --- .github/workflows/build-python-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-python-package.yml b/.github/workflows/build-python-package.yml index 0f6e3c050..5e484bdd0 100644 --- a/.github/workflows/build-python-package.yml +++ b/.github/workflows/build-python-package.yml @@ -21,7 +21,7 @@ jobs: - uses: actions/setup-python@v1 name: Install Python with: - python-version: '3.7' + python-version: '3.x' - name: Install cibuildwheel run: | @@ -59,7 +59,7 @@ jobs: - uses: actions/setup-python@v2 name: Install Python with: - python-version: '3.7' + python-version: '3.x' - name: Build sdist run: cd src/runtime/python && python setup.py sdist From 2c98075a0b68fa92959a1048cd0d1cec9ec20fd1 Mon Sep 17 00:00:00 2001 From: o1lo01ol1o Date: Wed, 15 Nov 2023 12:04:41 -0600 Subject: [PATCH 035/162] support ghc9.4 --- src/runtime/haskell/Data/Binary/Builder.hs | 11 +++++++++-- src/runtime/haskell/Data/Binary/Get.hs | 8 ++++++++ src/runtime/haskell/pgf.cabal | 12 ++++++------ 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/runtime/haskell/Data/Binary/Builder.hs b/src/runtime/haskell/Data/Binary/Builder.hs index 5f8983c0c..8dc46f816 100644 --- a/src/runtime/haskell/Data/Binary/Builder.hs +++ b/src/runtime/haskell/Data/Binary/Builder.hs @@ -74,13 +74,16 @@ import qualified Data.ByteString.Internal as S #endif #if defined(__GLASGOW_HASKELL__) && !defined(__HADDOCK__) -import GHC.Base(Int(..),uncheckedShiftRL# ) +import GHC.Base(Int(..),uncheckedShiftRL#,) import GHC.Word (Word32(..),Word16(..),Word64(..)) #if MIN_VERSION_base(4,16,0) import GHC.Exts (wordToWord16#, word16ToWord#, wordToWord32#, word32ToWord#) #endif -#if WORD_SIZE_IN_BITS < 64 && __GLASGOW_HASKELL__ >= 608 +#if WORD_SIZE_IN_BITS < 64 && __GLASGOW_HASKELL__ >= 608 +import GHC.Word (uncheckedShiftRL64#) +#endif +#if __GLASGOW_HASKELL__ >= 900 import GHC.Word (uncheckedShiftRL64#) #endif #endif @@ -433,7 +436,11 @@ foreign import ccall unsafe "stg_uncheckedShiftRL64" #endif #else +#if __GLASGOW_HASKELL__ <= 810 shiftr_w64 (W64# w) (I# i) = W64# (w `uncheckedShiftRL#` i) +#else +shiftr_w64 (W64# w) (I# i) = W64# (w `uncheckedShiftRL64#` i) +#endif #endif #else diff --git a/src/runtime/haskell/Data/Binary/Get.hs b/src/runtime/haskell/Data/Binary/Get.hs index 8faf249a9..a33c5c5a3 100644 --- a/src/runtime/haskell/Data/Binary/Get.hs +++ b/src/runtime/haskell/Data/Binary/Get.hs @@ -104,6 +104,9 @@ import GHC.Word #if MIN_VERSION_base(4,16,0) import GHC.Exts (wordToWord16#, word16ToWord#, wordToWord32#, word32ToWord#) #endif +#if __GLASGOW_HASKELL__ >= 900 +import GHC.Word (uncheckedShiftL64#) +#endif #endif -- Control.Monad.Fail import will become redundant in GHC 8.8+ @@ -553,7 +556,12 @@ foreign import ccall unsafe "stg_uncheckedShiftL64" #endif #else +#if __GLASGOW_HASKELL__ <= 810 shiftl_w64 (W64# w) (I# i) = W64# (w `uncheckedShiftL#` i) +#else +shiftl_w64 (W64# w) (I# i) = W64# (w `uncheckedShiftL64#` i) +#endif + #endif #else diff --git a/src/runtime/haskell/pgf.cabal b/src/runtime/haskell/pgf.cabal index cb5841a1c..404d3bc07 100644 --- a/src/runtime/haskell/pgf.cabal +++ b/src/runtime/haskell/pgf.cabal @@ -9,16 +9,16 @@ synopsis: Grammatical Framework description: A library for interpreting the Portable Grammar Format (PGF) homepage: https://www.grammaticalframework.org/ bug-reports: https://github.com/GrammaticalFramework/gf-core/issues -tested-with: GHC==7.10.3, GHC==8.0.2, GHC==8.10.4 +tested-with: GHC==7.10.3, GHC==8.0.2, GHC==8.10.4, GHC==9.4.5 library default-language: Haskell2010 build-depends: - array >= 0.5.1 && < 0.6, - base >= 4.9.1 && < 4.16, - bytestring >= 0.10.8 && < 0.11, - containers >= 0.5.7 && < 0.7, - ghc-prim >= 0.5.0 && < 0.7, + array >= 0.5.1 && < 0.7, + base >= 4.9.1 && < 5.0, + bytestring >= 0.10.8 && < 0.12, + containers >= 0.5.7 && < 0.8, + ghc-prim >= 0.5.0 && < 0.10, mtl >= 2.2.1 && < 2.3, pretty >= 1.1.3 && < 1.2, random >= 1.1 && < 1.3, From b59fe24c118826e91709170c97913a8db79374af Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 17 Nov 2023 14:11:59 +0100 Subject: [PATCH 036/162] use older python version to keep distutils --- .github/workflows/build-python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-python-package.yml b/.github/workflows/build-python-package.yml index 5e484bdd0..997ee7bd0 100644 --- a/.github/workflows/build-python-package.yml +++ b/.github/workflows/build-python-package.yml @@ -59,7 +59,7 @@ jobs: - uses: actions/setup-python@v2 name: Install Python with: - python-version: '3.x' + python-version: '3.10' - name: Build sdist run: cd src/runtime/python && python setup.py sdist From c2182274df0a0f730b4d4a41ea4a537cdb388ecd Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Thu, 14 Dec 2023 11:56:11 +0100 Subject: [PATCH 037/162] visualize_dependencies (vd) now creates latex in landscape mode to show long trees better --- src/runtime/haskell/PGF/VisualizeTree.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/runtime/haskell/PGF/VisualizeTree.hs b/src/runtime/haskell/PGF/VisualizeTree.hs index 32709bac0..4142332ac 100644 --- a/src/runtime/haskell/PGF/VisualizeTree.hs +++ b/src/runtime/haskell/PGF/VisualizeTree.hs @@ -651,6 +651,7 @@ app macro arg = text "\\" <> text macro <> text "{" <> arg <> text "}" latexDoc :: Doc -> Doc latexDoc body = vcat [text "\\documentclass{article}", + text "\\usepackage[a4paper,margin=0.5in,landscape]{geometry}", text "\\usepackage[utf8]{inputenc}", text "\\begin{document}", body, From 7e707508a72ce73d6c3e4b8881df37597f5b8801 Mon Sep 17 00:00:00 2001 From: aarneranta Date: Fri, 1 Mar 2024 09:17:08 +0100 Subject: [PATCH 038/162] showExpr and linearize now refresh the printed variables if needed --- src/runtime/haskell/PGF/Expr.hs | 17 ++++++++++++++--- src/runtime/haskell/PGF/Linearize.hs | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/runtime/haskell/PGF/Expr.hs b/src/runtime/haskell/PGF/Expr.hs index d015f18e0..ff1114235 100644 --- a/src/runtime/haskell/PGF/Expr.hs +++ b/src/runtime/haskell/PGF/Expr.hs @@ -17,7 +17,8 @@ module PGF.Expr(Tree, BindType(..), Expr(..), Literal(..), Patt(..), Equation(.. MetaId, -- helpers - pMeta,pArg,pLit,freshName,ppMeta,ppLit,ppParens + pMeta,pArg,pLit,freshName,ppMeta,ppLit,ppParens, + freshBoundVars ) where import PGF.CId @@ -235,10 +236,11 @@ pLit = liftM LStr (RP.readS_to_P reads) ppExpr :: Int -> [CId] -> Expr -> PP.Doc ppExpr d scope (EAbs b x e) = let (bs,xs,e1) = getVars [] [] (EAbs b x e) + xs' = freshBoundVars scope xs in ppParens (d > 1) (PP.char '\\' PP.<> - PP.hsep (PP.punctuate PP.comma (reverse (List.zipWith ppBind bs xs))) PP.<+> + PP.hsep (PP.punctuate PP.comma (reverse (List.zipWith ppBind bs xs'))) PP.<+> PP.text "->" PP.<+> - ppExpr 1 (xs++scope) e1) + ppExpr 1 (xs' ++ scope) e1) where getVars bs xs (EAbs b x e) = getVars (b:bs) ((freshName x xs):xs) e getVars bs xs e = (bs,xs,e) @@ -289,6 +291,15 @@ freshName x xs0 = loop 1 x | elem y xs = loop (i+1) (mkCId (show x++show i)) | otherwise = y +-- refresh new vars xs in scope if needed. AR 2024-03-01 +freshBoundVars :: [CId] -> [CId] -> [CId] +freshBoundVars scope xs = foldr fresh [] xs + where + fresh x xs' = mkCId (freshName (showCId x) xs') : xs' + freshName s xs' = + if elem (mkCId s) (xs' ++ scope) + then freshName (s ++ "'") xs' + else s ----------------------------------------------------- -- Computation diff --git a/src/runtime/haskell/PGF/Linearize.hs b/src/runtime/haskell/PGF/Linearize.hs index 5fdb186c1..a508f3dbc 100644 --- a/src/runtime/haskell/PGF/Linearize.hs +++ b/src/runtime/haskell/PGF/Linearize.hs @@ -81,7 +81,7 @@ linTree pgf cnc e = nub (map snd (lin Nothing 0 e [] [] e [])) where lp = lproductions cnc - lin mb_cty n_fid e0 ys xs (EAbs _ x e) es = lin mb_cty n_fid e0 ys (x:xs) e es + lin mb_cty n_fid e0 ys xs (EAbs _ x e) es = lin mb_cty n_fid e0 ys (freshBoundVars (xs ++ ys) [x] ++ xs) e es --fresh: AR 2024 lin mb_cty n_fid e0 ys xs (EApp e1 e2) es = lin mb_cty n_fid e0 ys xs e1 (e2:es) lin mb_cty n_fid e0 ys xs (EImplArg e) es = lin mb_cty n_fid e0 ys xs e es lin mb_cty n_fid e0 ys xs (ETyped e _) es = lin mb_cty n_fid e0 ys xs e es From 2f31bbab23a2bea8b32fcb3d370928ddb72a9735 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 15 Mar 2024 12:43:17 +0100 Subject: [PATCH 039/162] Apply gt to all arguments when piped --- src/compiler/GF/Command/Commands.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/GF/Command/Commands.hs b/src/compiler/GF/Command/Commands.hs index a6c66594f..f31a23083 100644 --- a/src/compiler/GF/Command/Commands.hs +++ b/src/compiler/GF/Command/Commands.hs @@ -218,9 +218,9 @@ pgfCommands = Map.fromList [ exec = getEnv $ \ opts arg (Env pgf mos) -> do let pgfr = optRestricted opts pgf let dp = valIntOpts "depth" 4 opts - let ts = case mexp (toExprs arg) of - Just ex -> generateFromDepth pgfr ex (Just dp) - Nothing -> generateAllDepth pgfr (optType pgf opts) (Just dp) + let ts = case toExprs arg of + [] -> generateAllDepth pgfr (optType pgf opts) (Just dp) + es -> concat [generateFromDepth pgfr e (Just dp) | e <- es] returnFromExprs $ take (optNumInf opts) ts }), ("i", emptyCommandInfo { From b855a094f8e09c4dc405015d74187020991a3ae7 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 29 Apr 2024 20:42:51 +0800 Subject: [PATCH 040/162] Clarify description for vt --- doc/tutorial/gf-tutorial.t2t | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/tutorial/gf-tutorial.t2t b/doc/tutorial/gf-tutorial.t2t index 2c8d909de..c43382ea0 100644 --- a/doc/tutorial/gf-tutorial.t2t +++ b/doc/tutorial/gf-tutorial.t2t @@ -1265,10 +1265,16 @@ Human eye may prefer to see a visualization: ``visualize_tree = vt``: > parse "this delicious cheese is very Italian" | visualize_tree ``` The tree is generated in postscript (``.ps``) file. The ``-view`` option is used for -telling what command to use to view the file. Its default is ``"open"``, which works -on Mac OS X. On Ubuntu Linux, one can write +telling what command to use to view the file. + +This works on Mac OS X: +``` + > parse "this delicious cheese is very Italian" | visualize_tree -view=open +``` +On Linux, one can write either of ``` > parse "this delicious cheese is very Italian" | visualize_tree -view="eog" + > parse "this delicious cheese is very Italian" | visualize_tree -view=xdg-open ``` From 2a654c085f16435a2efa33c0caa4b92143a920fa Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 29 Apr 2024 20:44:53 +0800 Subject: [PATCH 041/162] be consistent in the use of quotes --- doc/tutorial/gf-tutorial.t2t | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/tutorial/gf-tutorial.t2t b/doc/tutorial/gf-tutorial.t2t index c43382ea0..a734a57b6 100644 --- a/doc/tutorial/gf-tutorial.t2t +++ b/doc/tutorial/gf-tutorial.t2t @@ -1271,9 +1271,9 @@ This works on Mac OS X: ``` > parse "this delicious cheese is very Italian" | visualize_tree -view=open ``` -On Linux, one can write either of +On Linux, one can use one of the following commands. ``` - > parse "this delicious cheese is very Italian" | visualize_tree -view="eog" + > parse "this delicious cheese is very Italian" | visualize_tree -view=eog > parse "this delicious cheese is very Italian" | visualize_tree -view=xdg-open ``` From c65dc70aaf413a1db9f857cde9a3ef58f851211c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Sep 2024 21:17:51 +0000 Subject: [PATCH 042/162] Bump actions/download-artifact from 2 to 4.1.7 in /.github/workflows Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 2 to 4.1.7. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v2...v4.1.7) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- .github/workflows/build-python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-python-package.yml b/.github/workflows/build-python-package.yml index 997ee7bd0..97f13c6fc 100644 --- a/.github/workflows/build-python-package.yml +++ b/.github/workflows/build-python-package.yml @@ -85,7 +85,7 @@ jobs: - name: Install twine run: pip install twine - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v4.1.7 with: name: artifact path: ./dist From ed0a8ca0df669ae9713fe189e580c1f18b3dacea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Wed, 23 Oct 2024 15:34:01 +0200 Subject: [PATCH 043/162] Update setup-python github action Let's see if this fixes CI --- .github/workflows/build-python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-python-package.yml b/.github/workflows/build-python-package.yml index 97f13c6fc..30995372c 100644 --- a/.github/workflows/build-python-package.yml +++ b/.github/workflows/build-python-package.yml @@ -18,7 +18,7 @@ jobs: steps: - uses: actions/checkout@v1 - - uses: actions/setup-python@v1 + - uses: actions/setup-python@v5.20 name: Install Python with: python-version: '3.x' From eaec428a89cb5313991a5fa37a76a476a1e85651 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Wed, 23 Oct 2024 15:35:39 +0200 Subject: [PATCH 044/162] fix typo --- .github/workflows/build-python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-python-package.yml b/.github/workflows/build-python-package.yml index 30995372c..6076946eb 100644 --- a/.github/workflows/build-python-package.yml +++ b/.github/workflows/build-python-package.yml @@ -18,7 +18,7 @@ jobs: steps: - uses: actions/checkout@v1 - - uses: actions/setup-python@v5.20 + - uses: actions/setup-python@v5.2.0 name: Install Python with: python-version: '3.x' From fc614cd48ee60ceeda212a7f47f18e1cb69c72e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Wed, 23 Oct 2024 15:40:29 +0200 Subject: [PATCH 045/162] Bump more action versions --- .github/workflows/build-python-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-python-package.yml b/.github/workflows/build-python-package.yml index 6076946eb..c18709c69 100644 --- a/.github/workflows/build-python-package.yml +++ b/.github/workflows/build-python-package.yml @@ -46,7 +46,7 @@ jobs: run: | python -m cibuildwheel src/runtime/python --output-dir wheelhouse - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: path: ./wheelhouse @@ -78,7 +78,7 @@ jobs: - uses: actions/checkout@v2 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5.2.0 with: python-version: '3.x' From 5eab0a626d5a047b53874eb9adbfb09dff812b6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Wed, 23 Oct 2024 15:47:14 +0200 Subject: [PATCH 046/162] add glibtoolize dependency for mac CI --- .github/workflows/build-python-package.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-python-package.yml b/.github/workflows/build-python-package.yml index c18709c69..bbc4d1dcc 100644 --- a/.github/workflows/build-python-package.yml +++ b/.github/workflows/build-python-package.yml @@ -18,7 +18,7 @@ jobs: steps: - uses: actions/checkout@v1 - - uses: actions/setup-python@v5.2.0 + - uses: actions/setup-python@v5 name: Install Python with: python-version: '3.x' @@ -31,6 +31,7 @@ jobs: if: startsWith(matrix.os, 'macos') run: | brew install automake + brew install libtool - name: Build wheels on Linux if: startsWith(matrix.os, 'macos') != true @@ -64,7 +65,7 @@ jobs: - name: Build sdist run: cd src/runtime/python && python setup.py sdist - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: path: ./src/runtime/python/dist/*.tar.gz @@ -78,7 +79,7 @@ jobs: - uses: actions/checkout@v2 - name: Set up Python - uses: actions/setup-python@v5.2.0 + uses: actions/setup-python@v5 with: python-version: '3.x' From 9492967fc6b48b55c9fbc1b4e9a20c5d61daba4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Wed, 23 Oct 2024 16:08:09 +0200 Subject: [PATCH 047/162] add sudo to make install to fix CI failure --- .github/workflows/build-python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-python-package.yml b/.github/workflows/build-python-package.yml index bbc4d1dcc..8260fbd98 100644 --- a/.github/workflows/build-python-package.yml +++ b/.github/workflows/build-python-package.yml @@ -43,7 +43,7 @@ jobs: - name: Build wheels on OSX if: startsWith(matrix.os, 'macos') env: - CIBW_BEFORE_BUILD: cd src/runtime/c && glibtoolize && autoreconf -i && ./configure && make && make install + CIBW_BEFORE_BUILD: cd src/runtime/c && glibtoolize && autoreconf -i && ./configure && make && sudo make install run: | python -m cibuildwheel src/runtime/python --output-dir wheelhouse From 33b0bab6106a3bbfc02fb3bcb225bc2e67d1e0c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=A4llberg?= Date: Wed, 23 Oct 2024 16:22:59 +0200 Subject: [PATCH 048/162] Use different artifact names as is required by upload-artifact@v4 --- .github/workflows/build-python-package.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-python-package.yml b/.github/workflows/build-python-package.yml index 8260fbd98..d7d8ac94a 100644 --- a/.github/workflows/build-python-package.yml +++ b/.github/workflows/build-python-package.yml @@ -49,6 +49,7 @@ jobs: - uses: actions/upload-artifact@v4 with: + name: wheel-${{ matrix.os }} path: ./wheelhouse build_sdist: @@ -67,6 +68,7 @@ jobs: - uses: actions/upload-artifact@v4 with: + name: wheel-source path: ./src/runtime/python/dist/*.tar.gz upload_pypi: @@ -88,7 +90,8 @@ jobs: - uses: actions/download-artifact@v4.1.7 with: - name: artifact + pattern: wheel-* + merge-multiple: true path: ./dist - name: Publish From aa061aff0ce24c19ea36104744a586add27e3e71 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Tue, 26 Nov 2024 12:15:41 +0100 Subject: [PATCH 049/162] Update robots.txt --- src/www/robots.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/www/robots.txt b/src/www/robots.txt index 5b3ee3354..d559fc731 100644 --- a/src/www/robots.txt +++ b/src/www/robots.txt @@ -1,4 +1,5 @@ User-agent: * Disallow: /grammars Disallow: /robust +Disallow: /wikidata Disallow: /*.pgf From bc56b54dd12854c2e805dc597f906f879c46d908 Mon Sep 17 00:00:00 2001 From: aarneranta Date: Tue, 7 Jan 2025 11:20:23 +0100 Subject: [PATCH 050/162] random generation of literals now has ten different values for each built in type; maybe a better solution for most cases than just one value --- src/runtime/haskell/PGF/TypeCheck.hs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/runtime/haskell/PGF/TypeCheck.hs b/src/runtime/haskell/PGF/TypeCheck.hs index c5cc44b4e..82bd47b7a 100644 --- a/src/runtime/haskell/PGF/TypeCheck.hs +++ b/src/runtime/haskell/PGF/TypeCheck.hs @@ -147,9 +147,9 @@ typeGenerators scope cat = fmap normalize (liftM2 (++) x y) where Scope gamma = scope - y | cat == cidInt = return [(1.0,ELit (LInt 999), TTyp [] (DTyp [] cat []))] - | cat == cidFloat = return [(1.0,ELit (LFlt 3.14), TTyp [] (DTyp [] cat []))] - | cat == cidString = return [(1.0,ELit (LStr "Foo"),TTyp [] (DTyp [] cat []))] + y | cat == cidInt = return [(0.1, ELit (LInt n), TTyp [] (DTyp [] cat [])) | n <- ints] + | cat == cidFloat = return [(0.1, ELit (LFlt d), TTyp [] (DTyp [] cat [])) | d <- floats] + | cat == cidString = return [(0.1, ELit (LStr s),TTyp [] (DTyp [] cat [])) | s <- strs] | otherwise = TcM (\abstr k h ms -> case Map.lookup cat (cats abstr) of Just (_,fns,_) -> unTcM (mapM helper fns) abstr k h ms @@ -163,6 +163,11 @@ typeGenerators scope cat = fmap normalize (liftM2 (++) x y) where s = sum [p | (p,_,_) <- gens] + -- random elements of predefined types: many instead of one AR 2025-01-17 + ints = [1, 2, 3, 14, 42, 123, 999, 2025, 1000000, 1234567890] + floats = [0.0, 1.0, 3.14, 0.999, 0.5772156649, 2.71828, 6.62607015, 19.3, 0.0001, 1.60934] + strs = words "A B X Y b c x y foo bar" + emptyMetaStore :: MetaStore s emptyMetaStore = IntMap.empty From c7226cc11c4505e3946f6d95c7cb56c6cc3ce2fa Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Sat, 18 Jan 2025 07:13:24 +0100 Subject: [PATCH 051/162] add GFSS2025 + remove IRC channel --- index.html | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/index.html b/index.html index dd252ec94..214d8c66f 100644 --- a/index.html +++ b/index.html @@ -87,11 +87,6 @@

    Contribute

    From d790af2bd46b3c71ff949eb7bd68ec8a15825b69 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 05:44:28 +0200 Subject: [PATCH 117/162] add import Control.Monad in imports --- src/compiler/api/GF/Compile/PGFtoHaskell.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/api/GF/Compile/PGFtoHaskell.hs b/src/compiler/api/GF/Compile/PGFtoHaskell.hs index c5704e737..07024712c 100644 --- a/src/compiler/api/GF/Compile/PGFtoHaskell.hs +++ b/src/compiler/api/GF/Compile/PGFtoHaskell.hs @@ -50,7 +50,7 @@ grammar2haskell opts name gr = foldr (++++) [] $ derivingClause | dataExt = "deriving (Show,Data)" | otherwise = "deriving Show" - extraImports | gadt = ["import Control.Monad.Identity", "import Data.Monoid"] + extraImports | gadt = ["import Control.Monad.Identity", "import Control.Monad", "import Data.Monoid"] | dataExt = ["import Data.Data"] | otherwise = [] pgfImports = ["import PGF2", ""] From 1d1cc98e410b473a45ffd6289705d383b7adae74 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 05:53:13 +0200 Subject: [PATCH 118/162] merged more files from master --- .gitignore | 15 +++++------ doc/gf-developers.t2t | 61 +++++++++++++++++++++++++++---------------- flake.lock | 43 ++++++++++++++++++++++++++++++ flake.nix | 50 +++++++++++++++++++++++++++++++++++ nix/expose-all.patch | 12 +++++++++ 5 files changed, 150 insertions(+), 31 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 nix/expose-all.patch diff --git a/.gitignore b/.gitignore index 678397df2..93d660fcc 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,6 @@ *.jar *.gfo *.pgf -*.ngf debian/.debhelper debian/debhelper-build-stamp debian/gf @@ -47,8 +46,6 @@ src/runtime/c/sg/.dirstamp src/runtime/c/stamp-h1 src/runtime/java/.libs/ src/runtime/python/build/ -src/runtime/python/**/__pycache__/ -src/runtime/python/**/.pytest_cache/ .cabal-sandbox cabal.sandbox.config .stack-work @@ -56,12 +53,6 @@ DATA_DIR stack*.yaml.lock -# Generated source files -src/compiler/api/GF/Grammar/Lexer.hs -src/compiler/api/GF/Grammar/Parser.hs -src/compiler/api/PackageInfo_gf.hs -src/compiler/api/Paths_gf.hs - # Output files for test suite *.out gf-tests.html @@ -82,3 +73,9 @@ doc/icfp-2012.html download/*.html gf-book/index.html src/www/gf-web-api.html +.devenv +.direnv +result +.vscode +.envrc +.pre-commit-config.yaml \ No newline at end of file diff --git a/doc/gf-developers.t2t b/doc/gf-developers.t2t index c20afda52..aafe6d3f2 100644 --- a/doc/gf-developers.t2t +++ b/doc/gf-developers.t2t @@ -150,11 +150,9 @@ Open a terminal, go to the top directory (``gf-core``), and type the following c $ stack install ``` -It will install GF and all necessary tools and libraries to do that. - - === Alternative: use Cabal === -You can also install GF using Cabal, if you prefer Cabal to Stack. In that case, you may need to install some prerequisites yourself. + +If you prefer Cabal, then you just need to manually choose a suitable GHC to build GF. We recommend GHC 9.6.7, see other supported options in [gf.cabal https://github.com/GrammaticalFramework/gf-core/blob/master/gf.cabal#L14]. The actual installation process is similar to Stack: open a terminal, go to the top directory (``gf-core``), and type the following command. @@ -162,7 +160,13 @@ The actual installation process is similar to Stack: open a terminal, go to the $ cabal install ``` -//The old (potentially outdated) instructions for Cabal are moved to a [separate page ../doc/gf-developers-old-cabal.html]. If you run into trouble with ``cabal install``, you may want to take a look.// +=== Nix === + +As of 3.12, GF can also be installed via Nix. You can install GF from github with the following command: + +``` +nix profile install github:GrammaticalFramework/gf-core#gf +``` == Compiling GF with C runtime system support == @@ -197,7 +201,7 @@ Depending on what you want to do with the C runtime, you can follow one or more === Use the C runtime from another programming language ===[bindings] -% **If you just want to use the C runtime from Python, Java, or Haskell, you don't need to change your GF installation.** +% **If you just want to use the C runtime from Python or Haskell, you don't need to change your GF installation.** - **What —** This is the most common use case for the C runtime: compile @@ -230,20 +234,13 @@ modes (use the ``help`` command in the shell for details). (Re)compiling your GF with these flags will also give you Haskell bindings to the C runtime, as a library called ``PGF2``, -but if you want Python or Java bindings, you need to do [the previous step #bindings]. +but if you want Python bindings, you need to do [the previous step #bindings]. % ``PGF2``: a module to import in Haskell programs, providing a binding to the C run-time system. - **How —** -If you use cabal, run the following command: -``` -cabal install -fc-runtime -``` - -from the top directory (``gf-core``). - -If you use stack, uncomment the following lines in the ``stack.yaml`` file: +Add (or uncomment) the following lines in the ``stack.yaml`` file: ``` flags: @@ -254,6 +251,32 @@ extra-lib-dirs: ``` and then run ``stack install`` from the top directory (``gf-core``). +Run the newly built executable with the flag ``-cshell``, and you should see the following welcome message: + +``` +$ gf -cshell + + * * * + * * + * * + * + * + * * * * * * * + * * * + * * * * * * + * * * + * * * + +This is GF version 3.12.0. +Built on ... +Git info: ... + +Flags: interrupt server c-runtime +License: see help -license. + +This shell uses the C run-time system. See help for available commands. +> +``` //If you get an "``error while loading shared libraries``" when trying to run GF with C runtime, remember to declare your ``LD_LIBRARY_PATH``.// //Add ``export LD_LIBRARY_PATH="/usr/local/lib"`` to either your ``.bashrc`` or ``.profile``. You should now be able to start GF with C runtime.// @@ -266,14 +289,8 @@ With this feature, ``gf -server`` mode is extended with new requests to call the system, e.g. ``c-parse``, ``c-linearize`` and ``c-translate``. - **How —** -If you use cabal, run the following command: -``` -cabal install -fc-runtime -fserver -``` -from the top directory. - -If you use stack, add the following lines in the ``stack.yaml`` file: +Add the following lines in the ``stack.yaml`` file: ``` flags: diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..232e59372 --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1704290814, + "narHash": "sha256-LWvKHp7kGxk/GEtlrGYV68qIvPHkU9iToomNFGagixU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "70bdadeb94ffc8806c0570eb5c2695ad29f0e421", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "systems": "systems" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 000000000..ccacc15b0 --- /dev/null +++ b/flake.nix @@ -0,0 +1,50 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; + systems.url = "github:nix-systems/default"; + }; + + nixConfig = { + # extra-trusted-public-keys = + # "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="; + # extra-substituters = "https://devenv.cachix.org"; + }; + + outputs = { self, nixpkgs, systems, ... }@inputs: + let forEachSystem = nixpkgs.lib.genAttrs (import systems); + in { + packages = forEachSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + haskellPackages = pkgs.haskell.packages.ghc925.override { + overrides = self: _super: { + cgi = pkgs.haskell.lib.unmarkBroken (pkgs.haskell.lib.dontCheck + (self.callHackage "cgi" "3001.5.0.1" { })); + }; + }; + + in { + gf = pkgs.haskell.lib.overrideCabal + (haskellPackages.callCabal2nixWithOptions "gf" self "--flag=-server" + { }) (_old: { + # Fix utf8 encoding problems + patches = [ + # Already applied in master + # ( + # pkgs.fetchpatch { + # url = "https://github.com/anka-213/gf-core/commit/6f1ca05fddbcbc860898ddf10a557b513dfafc18.patch"; + # sha256 = "17vn3hncxm1dwbgpfmrl6gk6wljz3r28j191lpv5zx741pmzgbnm"; + # } + # ) + ./nix/expose-all.patch + ./nix/revert-new-cabal-madness.patch + ]; + jailbreak = true; + # executableSystemDepends = [ + # (pkgs.ncurses.override { enableStatic = true; }) + # ]; + # executableHaskellDepends = [ ]; + }); + }); + }; +} diff --git a/nix/expose-all.patch b/nix/expose-all.patch new file mode 100644 index 000000000..bca529157 --- /dev/null +++ b/nix/expose-all.patch @@ -0,0 +1,12 @@ +diff --git a/gf.cabal b/gf.cabal +index 0076e7638..8d3fe4b49 100644 +--- a/gf.cabal ++++ b/gf.cabal +@@ -168,7 +168,6 @@ Library + GF.Text.Lexing + GF.Grammar.Canonical + +- other-modules: + GF.Main + GF.Compiler + GF.Interactive \ No newline at end of file From 419737585485bc7ac1115c599dcb140b67ef547b Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 06:15:20 +0200 Subject: [PATCH 119/162] more updates from master --- .github/workflows/build-binary-packages.yml | 122 +++++++++++--------- .github/workflows/build-python-package.yml | 38 +++--- doc/tutorial/gf-tutorial.t2t | 27 +++-- 3 files changed, 107 insertions(+), 80 deletions(-) diff --git a/.github/workflows/build-binary-packages.yml b/.github/workflows/build-binary-packages.yml index 493d5e774..f4c1a5b5e 100644 --- a/.github/workflows/build-binary-packages.yml +++ b/.github/workflows/build-binary-packages.yml @@ -2,7 +2,7 @@ name: Build Binary Packages on: workflow_dispatch: - release: + release: types: ["created"] jobs: @@ -13,9 +13,9 @@ jobs: name: Build Ubuntu package strategy: matrix: - os: - - ubuntu-18.04 - - ubuntu-20.04 + ghc: ["9.6"] + cabal: ["3.10"] + os: ["ubuntu-24.04"] runs-on: ${{ matrix.os }} @@ -25,12 +25,13 @@ jobs: # Note: `haskell-platform` is listed as requirement in debian/control, # which is why it's installed using apt instead of the Setup Haskell action. - # - name: Setup Haskell - # uses: actions/setup-haskell@v1 - # id: setup-haskell-cabal - # with: - # ghc-version: ${{ matrix.ghc }} - # cabal-version: ${{ matrix.cabal }} + - name: Setup Haskell + uses: haskell-actions/setup@v2 + id: setup-haskell-cabal + with: + ghc-version: ${{ matrix.ghc }} + cabal-version: ${{ matrix.cabal }} + if: matrix.os == 'ubuntu-24.04' - name: Install build tools run: | @@ -39,14 +40,15 @@ jobs: make \ dpkg-dev \ debhelper \ - haskell-platform \ libghc-json-dev \ - python-dev \ default-jdk \ - libtool-bin - + python-dev-is-python3 \ + libtool-bin + cabal install alex happy + - name: Build package run: | + export PYTHONPATH="/home/runner/work/gf-core/gf-core/debian/gf/usr/local/lib/python3.12/dist-packages/" make deb - name: Copy package @@ -54,7 +56,7 @@ jobs: cp ../gf_*.deb dist/ - name: Upload artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: gf-${{ github.event.release.tag_name }}-${{ matrix.os }}.deb path: dist/gf_*.deb @@ -64,14 +66,14 @@ jobs: run: | mv dist/gf_*.deb dist/gf-${{ github.event.release.tag_name }}-${{ matrix.os }}.deb - - uses: actions/upload-release-asset@v1.0.2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: dist/gf-${{ github.event.release.tag_name }}-${{ matrix.os }}.deb - asset_name: gf-${{ github.event.release.tag_name }}-${{ matrix.os }}.deb - asset_content_type: application/octet-stream + #- uses: actions/upload-release-asset@v1.0.2 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ github.event.release.upload_url }} + # asset_path: dist/gf-${{ github.event.release.tag_name }}-${{ matrix.os }}.deb + # asset_name: gf-${{ github.event.release.tag_name }}-${{ matrix.os }}.deb + # asset_content_type: application/octet-stream # --- @@ -79,16 +81,16 @@ jobs: name: Build macOS package strategy: matrix: - ghc: ["8.6.5"] - cabal: ["2.4"] - os: ["macos-10.15"] + ghc: ["9.6"] + cabal: ["3.10"] + os: ["macos-latest", "macos-13"] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 - name: Setup Haskell - uses: actions/setup-haskell@v1 + uses: haskell-actions/setup@v2 id: setup-haskell-cabal with: ghc-version: ${{ matrix.ghc }} @@ -97,8 +99,10 @@ jobs: - name: Install build tools run: | brew install \ - automake + automake \ + libtool cabal v1-install alex happy + pip install setuptools - name: Build package run: | @@ -107,24 +111,24 @@ jobs: make pkg - name: Upload artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: - name: gf-${{ github.event.release.tag_name }}-macos + name: gf-${{ github.event.release.tag_name }}-${{ matrix.os }} path: dist/gf-*.pkg if-no-files-found: error - + - name: Rename package run: | mv dist/gf-*.pkg dist/gf-${{ github.event.release.tag_name }}-macos.pkg - - uses: actions/upload-release-asset@v1.0.2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: dist/gf-${{ github.event.release.tag_name }}-macos.pkg - asset_name: gf-${{ github.event.release.tag_name }}-macos.pkg - asset_content_type: application/octet-stream + #- uses: actions/upload-release-asset@v1.0.2 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ github.event.release.upload_url }} + # asset_path: dist/gf-${{ github.event.release.tag_name }}-macos.pkg + # asset_name: gf-${{ github.event.release.tag_name }}-macos.pkg + # asset_content_type: application/octet-stream # --- @@ -132,9 +136,9 @@ jobs: name: Build Windows package strategy: matrix: - ghc: ["8.6.5"] - cabal: ["2.4"] - os: ["windows-2019"] + ghc: ["9.6.7"] + cabal: ["3.10"] + os: ["windows-2022"] runs-on: ${{ matrix.os }} steps: @@ -147,6 +151,7 @@ jobs: base-devel gcc python-devel + autotools - name: Prepare dist folder shell: msys2 {0} @@ -171,7 +176,8 @@ jobs: - name: Build Java bindings shell: msys2 {0} run: | - export JDKPATH=/c/hostedtoolcache/windows/Java_Adopt_jdk/8.0.292-10/x64 + echo $JAVA_HOME_8_X64 + export JDKPATH="$(cygpath -u "${JAVA_HOME_8_X64}")" export PATH="${PATH}:${JDKPATH}/bin" cd src/runtime/java make \ @@ -180,6 +186,9 @@ jobs: make install cp .libs/msys-jpgf-0.dll /c/tmp-dist/java/jpgf.dll cp jpgf.jar /c/tmp-dist/java + if: false + + # - uses: actions/setup-python@v5 - name: Build Python bindings shell: msys2 {0} @@ -188,12 +197,13 @@ jobs: EXTRA_LIB_DIRS: /mingw64/lib run: | cd src/runtime/python + pacman --noconfirm -S python-setuptools python setup.py build python setup.py install - cp /usr/lib/python3.9/site-packages/pgf* /c/tmp-dist/python + cp -r /usr/lib/python3.12/site-packages/pgf* /c/tmp-dist/python - name: Setup Haskell - uses: actions/setup-haskell@v1 + uses: haskell-actions/setup@v2 id: setup-haskell-cabal with: ghc-version: ${{ matrix.ghc }} @@ -205,13 +215,13 @@ jobs: - name: Build GF run: | - cabal install --only-dependencies -fserver + cabal install -fserver --only-dependencies cabal configure -fserver cabal build - copy dist\build\gf\gf.exe C:\tmp-dist + copy dist-newstyle/build/x86_64-windows/ghc-${{matrix.ghc}}/*/x/gf/build/gf/gf.exe C:/tmp-dist - name: Upload artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: gf-${{ github.event.release.tag_name }}-windows path: C:\tmp-dist\* @@ -220,11 +230,11 @@ jobs: - name: Create archive run: | Compress-Archive C:\tmp-dist C:\gf-${{ github.event.release.tag_name }}-windows.zip - - uses: actions/upload-release-asset@v1.0.2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: C:\gf-${{ github.event.release.tag_name }}-windows.zip - asset_name: gf-${{ github.event.release.tag_name }}-windows.zip - asset_content_type: application/zip + #- uses: actions/upload-release-asset@v1.0.2 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ github.event.release.upload_url }} + # asset_path: C:\gf-${{ github.event.release.tag_name }}-windows.zip + # asset_name: gf-${{ github.event.release.tag_name }}-windows.zip + # asset_content_type: application/zip diff --git a/.github/workflows/build-python-package.yml b/.github/workflows/build-python-package.yml index 67cbba6dd..b2565eb05 100644 --- a/.github/workflows/build-python-package.yml +++ b/.github/workflows/build-python-package.yml @@ -13,24 +13,25 @@ jobs: strategy: fail-fast: true matrix: - os: [ubuntu-18.04, macos-10.15] + os: [ubuntu-latest, macos-latest, macos-13] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - - uses: actions/setup-python@v1 + - uses: actions/setup-python@v5 name: Install Python with: - python-version: '3.7' + python-version: '3.x' - name: Install cibuildwheel run: | - python -m pip install git+https://github.com/joerick/cibuildwheel.git@main + python -m pip install cibuildwheel - name: Install build tools for OSX if: startsWith(matrix.os, 'macos') run: | brew install automake + brew install libtool - name: Build wheels on Linux if: startsWith(matrix.os, 'macos') != true @@ -42,30 +43,32 @@ jobs: - name: Build wheels on OSX if: startsWith(matrix.os, 'macos') env: - CIBW_BEFORE_BUILD: cd src/runtime/c && glibtoolize && autoreconf -i && ./configure && make && make install + CIBW_BEFORE_BUILD: cd src/runtime/c && glibtoolize && autoreconf -i && ./configure && make && sudo make install run: | python -m cibuildwheel src/runtime/python --output-dir wheelhouse - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: + name: wheel-${{ matrix.os }} path: ./wheelhouse build_sdist: name: Build source distribution runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v5 name: Install Python with: - python-version: '3.7' + python-version: '3.10' - name: Build sdist run: cd src/runtime/python && python setup.py sdist - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: + name: wheel-source path: ./src/runtime/python/dist/*.tar.gz upload_pypi: @@ -75,24 +78,25 @@ jobs: if: github.ref == 'refs/heads/master' && github.event_name == 'push' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: '3.x' - name: Install twine run: pip install twine - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v4.1.7 with: - name: artifact + pattern: wheel-* + merge-multiple: true path: ./dist - name: Publish env: TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.pypi_password }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | - (cd ./src/runtime/python && curl -I --fail https://pypi.org/project/$(python setup.py --name)/$(python setup.py --version)/) || twine upload dist/* + twine upload --verbose --non-interactive --skip-existing dist/* \ No newline at end of file diff --git a/doc/tutorial/gf-tutorial.t2t b/doc/tutorial/gf-tutorial.t2t index 63407a38a..d58b93f16 100644 --- a/doc/tutorial/gf-tutorial.t2t +++ b/doc/tutorial/gf-tutorial.t2t @@ -1188,7 +1188,7 @@ use ``generate_trees = gt``. this wine is fresh this wine is warm ``` -The default **depth** is 3; the depth can be +The default **depth** is 5; the depth can be set by using the ``depth`` flag: ``` > generate_trees -depth=2 | l @@ -1265,10 +1265,16 @@ Human eye may prefer to see a visualization: ``visualize_tree = vt``: > parse "this delicious cheese is very Italian" | visualize_tree ``` The tree is generated in postscript (``.ps``) file. The ``-view`` option is used for -telling what command to use to view the file. Its default is ``"open"``, which works -on Mac OS X. On Ubuntu Linux, one can write +telling what command to use to view the file. + +This works on Mac OS X: ``` - > parse "this delicious cheese is very Italian" | visualize_tree -view="eog" + > parse "this delicious cheese is very Italian" | visualize_tree -view=open +``` +On Linux, one can use one of the following commands. +``` + > parse "this delicious cheese is very Italian" | visualize_tree -view=eog + > parse "this delicious cheese is very Italian" | visualize_tree -view=xdg-open ``` @@ -1733,6 +1739,13 @@ A new module can **extend** an old one: Pizza : Kind ; } ``` +Note that the extended grammar doesn't inherit the start +category from the grammar it extends, so if you want to +generate sentences with this grammar, you'll have to either +add a startcat (e.g. ``flags startcat = Question ;``), +or in the GF shell, specify the category to ``generate_random`` or ``geneate_trees`` +(e.g. ``gr -cat=Comment`` or ``gt -cat=Question``). + Parallel to the abstract syntax, extensions can be built for concrete syntaxes: ``` @@ -3733,7 +3746,7 @@ However, type-incorrect commands are rejected by the typecheck: The parsing is successful but the type checking failed with error(s): Couldn't match expected type Device light against the interred type Device fan - In the expression: DKindOne fan + In the expression: DKindOne fan ``` #NEW @@ -4171,7 +4184,7 @@ division of integers. ``` abstract Calculator = { flags startcat = Exp ; - + cat Exp ; fun @@ -4578,7 +4591,7 @@ in any multilingual grammar between any languages in the grammar. module Main where import PGF -import System (getArgs) +import System.Environment (getArgs) main :: IO () main = do From 4b5fec468558bbd4c7759adf571999bde30ad754 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 06:30:01 +0200 Subject: [PATCH 120/162] upgrade to upload-artifact@v4 --- .github/workflows/build-majestic.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index 3a3b934ff..b9940129e 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -25,7 +25,7 @@ jobs: make install - name: Upload artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: libpgf-linux path: | @@ -68,7 +68,7 @@ jobs: cabal v1-install - name: Upload artifact - uses: actions/upload-artifact@master + uses: actions/upload-artifact@v4 with: name: compiler-linux path: | @@ -99,7 +99,7 @@ jobs: run: | python3 -m cibuildwheel src/runtime/python --output-dir wheelhouse - - uses: actions/upload-artifact@master + - uses: actions/upload-artifact@v4 with: name: python-linux path: ./wheelhouse @@ -160,7 +160,7 @@ jobs: sudo make install - name: Upload artifact - uses: actions/upload-artifact@master + uses: actions/upload-artifact@v4 with: name: libpgf-macos path: | @@ -223,7 +223,7 @@ jobs: run: | python3 -m cibuildwheel src/runtime/python --output-dir wheelhouse - - uses: actions/upload-artifact@master + - uses: actions/upload-artifact@v4 with: name: python-macos path: ./wheelhouse @@ -289,7 +289,7 @@ jobs: make install - name: Upload artifact - uses: actions/upload-artifact@master + uses: actions/upload-artifact@v4 with: name: libpgf-windows path: | @@ -324,7 +324,7 @@ jobs: run: | python3 -m cibuildwheel src\runtime\python --output-dir wheelhouse - - uses: actions/upload-artifact@master + - uses: actions/upload-artifact@v4 with: name: python-windows path: ./wheelhouse From 82de600301b1cd8ae8122566f9a05d36aea192a2 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 06:33:15 +0200 Subject: [PATCH 121/162] try actions/checkout@v7 --- .github/workflows/build-majestic.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index b9940129e..9b1dfef9b 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -14,7 +14,7 @@ jobs: image: quay.io/pypa/manylinux2014_x86_64:2024-01-08-eb135ed steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v7 - name: Build runtime working-directory: ./src/runtime/c @@ -38,7 +38,7 @@ jobs: needs: linux-runtime steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v7 - name: Download artifact uses: actions/download-artifact@v3 with: @@ -80,7 +80,7 @@ jobs: needs: linux-runtime steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v7 - name: Download artifact uses: actions/download-artifact@v3 with: @@ -110,7 +110,7 @@ jobs: # needs: linux-runtime # # steps: -# - uses: actions/checkout@v3 +# - uses: actions/checkout@v7 # - name: Download artifact # uses: actions/download-artifact@master # with: @@ -141,7 +141,7 @@ jobs: runs-on: macOS-11 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v7 - name: Install build tools run: | @@ -173,7 +173,7 @@ jobs: needs: macos-runtime steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v7 - name: Download artifact uses: actions/download-artifact@master with: @@ -202,7 +202,7 @@ jobs: MACOSX_DEPLOYMENT_TARGET: 11.0 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v7 - name: Download artifact uses: actions/download-artifact@master with: @@ -234,7 +234,7 @@ jobs: # needs: macos-runtime # # steps: -# - uses: actions/checkout@v3 +# - uses: actions/checkout@v7 # - name: Download artifact # uses: actions/download-artifact@master # with: @@ -265,7 +265,7 @@ jobs: runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v7 - name: Setup MSYS2 uses: msys2/setup-msys2@v2 @@ -305,7 +305,7 @@ jobs: runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v7 - name: Setup Python uses: actions/setup-python@v4 @@ -336,7 +336,7 @@ jobs: if: github.ref == 'refs/heads/majestic' && github.event_name == 'push' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v7 - name: Set up Python uses: actions/setup-python@v3 From 116c8bd8d003e665db7e5ad86ab27fc3d10cac91 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 06:41:37 +0200 Subject: [PATCH 122/162] try newer version of manylinux --- .github/workflows/build-majestic.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index 9b1dfef9b..9b424cf7d 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -11,7 +11,7 @@ jobs: name: Runtime (Linux) runs-on: ubuntu-latest container: - image: quay.io/pypa/manylinux2014_x86_64:2024-01-08-eb135ed + image: quay.io/pypa/manylinux_2_28_x86_64 steps: - uses: actions/checkout@v7 From 8aaa469272182509cfb4eddea3bb0209bdfddce7 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 06:44:39 +0200 Subject: [PATCH 123/162] upgrade to download-artefact@v4 --- .github/workflows/build-majestic.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index 9b424cf7d..40246df5a 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -40,7 +40,7 @@ jobs: steps: - uses: actions/checkout@v7 - name: Download artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: libpgf-linux - run: | @@ -82,7 +82,7 @@ jobs: steps: - uses: actions/checkout@v7 - name: Download artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: libpgf-linux @@ -175,7 +175,7 @@ jobs: steps: - uses: actions/checkout@v7 - name: Download artifact - uses: actions/download-artifact@master + uses: actions/download-artifact@v4 with: name: libpgf-macos - run: | @@ -204,7 +204,7 @@ jobs: steps: - uses: actions/checkout@v7 - name: Download artifact - uses: actions/download-artifact@master + uses: actions/download-artifact@v4 with: name: libpgf-macos - run: | @@ -346,17 +346,17 @@ jobs: - name: Install twine run: pip install twine - - uses: actions/download-artifact@master + - uses: actions/download-artifact@v4 with: name: python-linux path: ./dist - - uses: actions/download-artifact@master + - uses: actions/download-artifact@v4 with: name: python-macos path: ./dist - - uses: actions/download-artifact@master + - uses: actions/download-artifact@v4 with: name: python-windows path: ./dist From cdbf6b307c8bc2e92c9e2addb6ab71a1b73efee7 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 06:49:40 +0200 Subject: [PATCH 124/162] update the test file after the changes in the format --- src/runtime/haskell/tests/basic.pgf | Bin 761 -> 392 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/runtime/haskell/tests/basic.pgf b/src/runtime/haskell/tests/basic.pgf index 3b643d5ef755ec67299e73ee26478df2ef641cfe..e0fa90ab75e81964fc86ad377990f5ca43f6f00d 100644 GIT binary patch delta 9 Qcmey#+QGb`osp3N01{0C!vFvP delta 380 zcmeBR{>i$bow1&gGbyn+GdVsvFPVXjk%57Mfg40HGpaE&o!iaE#K^$L%&5c0#K_3Z zsK>y_z`zWV)@EijWMpPEU}R=AWM^j1ODthyX4GHV)pFftZ1GJ(Xv z1Oo#T0|T>X9+Gf9ND?g0=m%5G$Oux$04A9j7#IU!5@2Bli0WWQ26U6zf=h}r^U|@X z=3q=_WMBj%kbw*wX&}e>WR@_NFo68Tz{tRynU@0g8j?Cjw#>W|kSe&Myu=c)DG(;_~_j8zPbAjr(bSj=e1SjA`n0Lu|1xBvhE From 3357c0c9d42baf4bcd6c503c95e8de062958eeb0 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 06:55:33 +0200 Subject: [PATCH 125/162] switch to haskell-actions/setup --- .github/workflows/build-majestic.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index 40246df5a..ffc14c716 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -48,7 +48,7 @@ jobs: sudo mv include/* /usr/local/include/ - name: Setup Haskell - uses: haskell/actions/setup@v2 + uses: haskell-actions/setup with: ghc-version: 8 @@ -183,7 +183,7 @@ jobs: sudo mv include/* /usr/local/include/ - name: Setup Haskell - uses: haskell/actions/setup@v2 + uses: haskell-actions/setup with: ghc-version: 8 From 53e7e4bb521818a59d809a4150449fa3ef173349 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 06:58:34 +0200 Subject: [PATCH 126/162] added version number to haskell-actions --- .github/workflows/build-majestic.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index ffc14c716..da4de8adc 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -48,7 +48,7 @@ jobs: sudo mv include/* /usr/local/include/ - name: Setup Haskell - uses: haskell-actions/setup + uses: haskell-actions/setup@v2 with: ghc-version: 8 @@ -183,7 +183,7 @@ jobs: sudo mv include/* /usr/local/include/ - name: Setup Haskell - uses: haskell-actions/setup + uses: haskell-actions/setup@v2 with: ghc-version: 8 From 9c4feb151b05a51b8cf55cd975fd51b98f99d37a Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 07:03:27 +0200 Subject: [PATCH 127/162] bump Python version for Windows --- .github/workflows/build-majestic.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index da4de8adc..74168798f 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -310,7 +310,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.11' - name: Install cibuildwheel run: | From 911dc4b4c871b0263b0558f2969c395fa8fb35e8 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 07:10:54 +0200 Subject: [PATCH 128/162] mark the ItemComparator as const. Seems to be needed for MSV C++ --- src/runtime/c/pgf/parser.cxx | 2 +- src/runtime/c/pgf/parser.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runtime/c/pgf/parser.cxx b/src/runtime/c/pgf/parser.cxx index 603642add..5b9ba56e3 100644 --- a/src/runtime/c/pgf/parser.cxx +++ b/src/runtime/c/pgf/parser.cxx @@ -514,7 +514,7 @@ void PgfAbstractParser::combine(State *state, Item *item, CCat *ccat) state->push_item(item); } -bool PgfAbstractParser::ItemComparator::operator()(Item *item1, Item *item2) +bool PgfAbstractParser::ItemComparator::operator()(Item *item1, Item *item2) const { if (item1->rule.as_object() < item2->rule.as_object()) return true; diff --git a/src/runtime/c/pgf/parser.h b/src/runtime/c/pgf/parser.h index ed7b3baa4..38c5cac10 100644 --- a/src/runtime/c/pgf/parser.h +++ b/src/runtime/c/pgf/parser.h @@ -132,7 +132,7 @@ protected: } item_prob_comp; struct ItemComparator : std::less { - bool operator()(Item *item1, Item *item2); + bool operator()(Item *item1, Item *item2) const; }; struct Cont { From d3bb34f81bb01616713cad47bb33ad0d9f05c5c0 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 07:16:41 +0200 Subject: [PATCH 129/162] add explict type parameter for MSV C++ --- src/runtime/c/pgf/intervalmap.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runtime/c/pgf/intervalmap.h b/src/runtime/c/pgf/intervalmap.h index 59020fb76..ef676f69b 100644 --- a/src/runtime/c/pgf/intervalmap.h +++ b/src/runtime/c/pgf/intervalmap.h @@ -77,8 +77,8 @@ class PGF_INTERNAL_DECL interval_map { Node *upd_node(Node *node, Node *left, Node *right) { node->sz = 1+size(left)+size(right); - node->max = std::max((left == NULL) ? node->end : left->max, - (right == NULL) ? node->end : right->max); + node->max = std::max((left == NULL) ? node->end : left->max, + (right == NULL) ? node->end : right->max); node->left = left; node->right = right; return node; From 0091e1005710443fd054b7b3fb8b52bc76b160b5 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 07:24:54 +0200 Subject: [PATCH 130/162] try adding option /std:c++20 for Windows --- src/runtime/python/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/python/setup.py b/src/runtime/python/setup.py index 36bbd099c..01462852f 100644 --- a/src/runtime/python/setup.py +++ b/src/runtime/python/setup.py @@ -15,7 +15,7 @@ if on_windows: cpath = '../c/pgf/' extra_sources = [cpath+f for f in os.listdir(cpath) if f.endswith('.cxx')] includes+=["../c"] - flags = ['/DCOMPILING_STATIC_PGF=1'] + flags = ['/DCOMPILING_STATIC_PGF=1', "/std:c++20"] else: extra_sources = [] flags = ['-std=c99', '-Werror', '-Wno-error=unused-variable', '-Wno-comment'] From 6d14d243c41c7938584e3a5950356c7da9f341df Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 07:36:27 +0200 Subject: [PATCH 131/162] explicit definitions for static members are needed for MSVC++ --- src/runtime/c/pgf/parser.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/runtime/c/pgf/parser.cxx b/src/runtime/c/pgf/parser.cxx index 5b9ba56e3..b2c30ebc2 100644 --- a/src/runtime/c/pgf/parser.cxx +++ b/src/runtime/c/pgf/parser.cxx @@ -14,6 +14,8 @@ PgfAbstractParser::PgfAbstractParser(ref concr) this->last_fid = concr->last_fid; } +PgfAbstractParser::ItemProbComparator PgfAbstractParser::item_prob_comp; + void PgfAbstractParser::get_info(CCat *ccat, ref *prule, size_t **pvalues) { if (ccat->fid <= concr->last_fid) { @@ -860,6 +862,8 @@ PgfParser::PgfParser(ref concr, PgfText *sentence, bool case_sensitive this->allocated_size = sizeof(PgfText)+sentence->size+1; } +PgfParser::ExprStateComparator PgfParser::estate_comp; + PgfParser::~PgfParser() { free(sentence); From 1799ee7bc60465e3e30ebea1743dabce03df127e Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 07:51:31 +0200 Subject: [PATCH 132/162] try with macOS-latest --- .github/workflows/build-majestic.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index 74168798f..3cf4c18a1 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -138,7 +138,7 @@ jobs: macos-runtime: name: Runtime (macOS) - runs-on: macOS-11 + runs-on: macOS-latest steps: - uses: actions/checkout@v7 From 37fbf70a2f890bb231caee1605662a3d47974d52 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 07:56:50 +0200 Subject: [PATCH 133/162] fix typo --- src/runtime/c/pgf/pgf.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/c/pgf/pgf.cxx b/src/runtime/c/pgf/pgf.cxx index c013a2c4a..8e924d4fa 100644 --- a/src/runtime/c/pgf/pgf.cxx +++ b/src/runtime/c/pgf/pgf.cxx @@ -1870,7 +1870,7 @@ public: this->sym_index = (size_t) -1; this->alt_index = (size_t) -1; this->n_lindefs = n_rules; - this->n_linrefs = n_linrefs; + this->n_linrefs = 0; this->n_args = 1; this->rule_index = 0; this->syms = 0; From 7b1f3bd16e80ed19cf316af4d81bbb88bbb1632b Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 08:05:50 +0200 Subject: [PATCH 134/162] propagate SymVar through the evaluator --- src/compiler/api/GF/Compile/Compute.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/compiler/api/GF/Compile/Compute.hs b/src/compiler/api/GF/Compile/Compute.hs index 76400d7d7..3dfd5d08b 100644 --- a/src/compiler/api/GF/Compile/Compute.hs +++ b/src/compiler/api/GF/Compile/Compute.hs @@ -78,6 +78,7 @@ data Value | VMarkup Ident [(Ident,Value)] [L Value] | VReset Ident (Maybe Value) Value (Maybe QIdent) | VSymCat Int LIndex [(LIndex, (Value, Type))] + | VSymVar Int Int | VError Doc | VInts Integer Bool @@ -311,6 +312,7 @@ eval g env c (Markup tag as ts) [] = in (VMarkup tag vas vs) eval g env c (Reset ctl mb_ct t qid) [] = VReset ctl (fmap (\t -> eval g env c t []) mb_ct) (eval g env c t []) qid eval g env c (TSymCat d r rs) []= VSymCat d r [(i,(fromJust (lookup pv env),ty)) | (i,(pv,ty)) <- rs] +eval g env c (TSymVar d j) []= VSymVar d j eval g env c t@(Opts n cs) vs = if null cs then VError ("No options in expression:" $$ ppTerm Unqualified 0 t) else let (c1,c2,c3) = split3 c @@ -439,6 +441,7 @@ bubble v = snd (bubble v) bubble (VSymCat d i0 vs) = let (union,vs') = mapAccumL descendC Map.empty vs in (union, addVariants (VSymCat d i0 vs') union) + bubble v@(VSymVar _ _) = lift0 v bubble v@(VError _) = lift0 v bubble v@(VInts _ _) = lift0 v @@ -577,6 +580,7 @@ patternMatch g s v0 ((env0,ps,args0,t):eqs) = match env0 ps eqs args0 (p, VP _ _ _) -> v0 (p, VS _ _ _) -> v0 (p, VSymCat _ _ _) -> v0 + (p, VSymVar _ _) -> v0 (PP q qs, VApp r vs) | q == r -> match env (qs++ps) eqs (vs++args) (PR pas, VR as) -> matchRec env (reverse pas) as ps eqs args @@ -1158,6 +1162,7 @@ ppValue q d (VReset ctl ct t _) = pp "[" <> pp ctl <> pp "|" <> ppValue q 0 t <> pp "]" ppValue q d (VSymCat i r rs) = pp '<' <> pp i <> pp ',' <> pp r <> pp '>' +ppValue q d (VSymVar i j) = pp '<' <> pp i <> pp ',' <> pp '$' <> pp j <> pp '>' ppValue q d (VError msg) = prec d 4 (pp "error" <+> ppTerm q 5 (K (show msg))) ppValue q d (VInts n ext) | ext = prec d 4 (pp "Ints" <+> brackets (pp n <> "..")) From f025a75e661a1911f083fd0662a851566d07cd3e Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 08:13:42 +0200 Subject: [PATCH 135/162] generate SymVar in PMCFG --- src/compiler/api/GF/Compile/GeneratePMCFG.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/compiler/api/GF/Compile/GeneratePMCFG.hs b/src/compiler/api/GF/Compile/GeneratePMCFG.hs index 3bc8cd5ce..4193611de 100644 --- a/src/compiler/api/GF/Compile/GeneratePMCFG.hs +++ b/src/compiler/api/GF/Compile/GeneratePMCFG.hs @@ -258,6 +258,7 @@ force (VSymCat d r rs) = do force_ (factor, (v, ty)) = do v <- force v return (factor, (v, ty)) +force (VSymVar d j) = return (VSymVar d j) force (VApp q vs) = do vs <- mapM force vs return (VApp q vs) @@ -306,6 +307,8 @@ flatten subst (VStr s) = return (subst,[SymKS s]) flatten subst (VSymCat d r rs) = do (subst,lin_index) <- params2int' subst r rs return (subst,[SymCat d lin_index]) +flatten subst (VSymVar d j) = do + return (subst,[SymVar d j]) flatten subst (VApp (m,id) []) | m == cPredef && id == cBIND = return (subst,[SymBIND]) | m == cPredef && id == cSOFT_BIND = return (subst,[SymSOFT_BIND]) From 79ce7825c6e8adce89710767aa1ab199d3de3e90 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 08:17:02 +0200 Subject: [PATCH 136/162] update the test grammar again --- src/runtime/haskell/tests/basic.pgf | Bin 392 -> 845 bytes src/runtime/haskell/tests/basic.pmcfg | 50 +++++++++++--------------- 2 files changed, 21 insertions(+), 29 deletions(-) diff --git a/src/runtime/haskell/tests/basic.pgf b/src/runtime/haskell/tests/basic.pgf index e0fa90ab75e81964fc86ad377990f5ca43f6f00d..c5080a1a81ac761888a2551ffbe6dc0783f5c4d9 100644 GIT binary patch literal 845 zcmZQzVqj!oO-d}zOlII@OlD+YjAvl~7Qo@{>TfoG~SOL<@z*q^Q7=sy56y&8agAEU0WMQmgV2o#CfGLk>U<_bn1rdxa zjK!=BPzkUg$cP6FV8E7{2X_RsXI=@q6Y>&44g@;^T`OZT*y$jT`5~FeSzJ<-nU@ap z8Cx)zi)Jp!v3?8;4E8W*Km!2A2RjAEVf2HmV+?@V36~6pOTw&zOL2muAU-)SnSl*r z0V88EBNHP7C=kKkhcG|_U@pj70!kSDuqa?;0vW^zGlww%iy9P5gBcm{xdZAG0;X^< zCNnakS&c|mAjg0(#ABIxDU948waj2X+^NirYRpXMcC#@tGO#f->aZ~}GBPvjF)%VP zz)}Xt3=jtEV+N%Mc91!Y3}7>uK_YC-j2dhpc{XN7O~ztK0E6@}Ga7>I12I9;49tw$ j%#4OeDFh?~!eCj(Dn>?-%?u38j0Q}M#f*lGRg4Az00(1w delta 9 QcmX@h*1^1?osp3N01(Lnm;e9( diff --git a/src/runtime/haskell/tests/basic.pmcfg b/src/runtime/haskell/tests/basic.pmcfg index 7586bfed3..d219e49c0 100644 --- a/src/runtime/haskell/tests/basic.pmcfg +++ b/src/runtime/haskell/tests/basic.pmcfg @@ -19,48 +19,40 @@ concrete basic_cnc { lincat Float = [ "s" ] - lindef Float(0) -> Float[String(0)] = [S0] - linref String(0) -> Float[Float(0)] = [S0] + lindef Float(0) -> Float[String(0)]; 0 : <0,0> + linref String(0) -> Float[Float(0)]; 0 : <0,0> lincat Int = [ "s" ] - lindef Int(0) -> Int[String(0)] = [S0] - linref String(0) -> Int[Int(0)] = [S0] + lindef Int(0) -> Int[String(0)]; 0 : <0,0> + linref String(0) -> Int[Int(0)]; 0 : <0,0> lincat N = [ "s" ] - lindef N(0) -> N[String(0)] = [S0] - linref {i<2} . String(0) -> N[N(i)] = [S0] + lindef N(0) -> N[String(0)]; 0 : <0,0> + linref {i<2} String(0) -> N[N(i)]; 0 : <0,0> lincat P = [ "s" ] - lindef P(0) -> P[String(0)] = [S0] - linref String(0) -> P[P(0)] = [S0] + lindef P(0) -> P[String(0)]; 0 : <0,0> + linref String(0) -> P[P(0)]; 0 : <0,0> lincat S = [ "" ] - lindef S(0) -> S[String(0)] = [S0] - linref String(0) -> S[S(0)] = [S0] + lindef S(0) -> S[String(0)]; 0 : <0,0> + linref String(0) -> S[S(0)]; 0 : <0,0> lincat String = [ "s" ] - lindef String(0) -> String[String(0)] = [S0] - linref String(0) -> String[String(0)] = [S0] - lin {i<2} . S(0) -> c[N(i)] = [S0] - lin S(0) -> floatLit[Float(0)] = [S0] - lin {i<2} . P(0) -> ind[P(0),P(0),N(i)] = [S1] - lin S(0) -> intLit[Int(0)] = [S0] - lin {i<2} . P(0) -> nat[N(i)] = [S5] - lin N(0) -> s[N(0)] = [S2] - lin N(0) -> s[N(1)] = [S4] - lin S(0) -> stringLit[String(0)] = [S0] - lin N(1) -> z[] = [S3] - sequences { - S0 = <0,0> - S1 = <0,0> "&" "λ" SOFT_BIND <1,$0> SOFT_BIND "," SOFT_BIND <1,$1> "." <1,0> - S2 = <0,0> "+" "1" - S3 = "0" - S4 = "1" - S5 = "nat" SOFT_BIND "(" SOFT_BIND <0,0> SOFT_BIND ")" - } + lindef String(0) -> String[String(0)]; 0 : <0,0> + linref String(0) -> String[String(0)]; 0 : <0,0> + lin {i<2} S(0) -> c[N(i)]; 0 : <0,0> + lin S(0) -> floatLit[Float(0)]; 0 : <0,0> + lin {i<2} P(0) -> ind[P(0),P(0),N(i)]; 0 : <0,0> "&" "λ" SOFT_BIND <1,$0> SOFT_BIND "," SOFT_BIND <1,$1> "." <1,0> + lin S(0) -> intLit[Int(0)]; 0 : <0,0> + lin {i<2} P(0) -> nat[N(i)]; 0 : "nat" SOFT_BIND "(" SOFT_BIND <0,0> SOFT_BIND ")" + lin N(0) -> s[N(1)]; 0 : "1" + lin N(0) -> s[N(0)]; 0 : <0,0> "+" "1" + lin S(0) -> stringLit[String(0)]; 0 : <0,0> + lin N(1) -> z[]; 0 : "0" } From 7d96554d490e3b20e1dedb128a4e4f40328037da Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 08:23:37 +0200 Subject: [PATCH 137/162] two more place to use macOS-latest --- .github/workflows/build-majestic.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index 3cf4c18a1..14b8c53d7 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -169,7 +169,7 @@ jobs: macos-haskell: name: Haskell (macOS) - runs-on: macOS-11 + runs-on: macOS-latest needs: macos-runtime steps: @@ -194,7 +194,7 @@ jobs: macos-python: name: Python (macOS) - runs-on: macOS-11 + runs-on: macOS-latest needs: macos-runtime env: EXTRA_INCLUDE_DIRS: /usr/local/include From 49a3eaaa39c3763e51c49a4ae918f15c14756db4 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 09:21:25 +0200 Subject: [PATCH 138/162] fix of by one error --- src/runtime/c/pgf/typechecker.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/c/pgf/typechecker.cxx b/src/runtime/c/pgf/typechecker.cxx index bcb8e194e..144daf8d8 100644 --- a/src/runtime/c/pgf/typechecker.cxx +++ b/src/runtime/c/pgf/typechecker.cxx @@ -82,7 +82,7 @@ PgfType PgfTypechecker::marshall_type(Type *ty, PgfUnmarshaller *u) for (;;) { Pi *pi = ty->is_pi(); if (pi) { - hypos = (PgfTypeHypo *) realloc(hypos, n_hypos*sizeof(PgfTypeHypo)); + hypos = (PgfTypeHypo *) realloc(hypos, (n_hypos+1)*sizeof(PgfTypeHypo)); PgfTypeHypo *hypo = &hypos[n_hypos++]; hypo->bind_type = pi->bind_type; hypo->cid = &pi->var; From 32cb9a2144161bd9660e86828a0a95dffb96fa63 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 09:31:19 +0200 Subject: [PATCH 139/162] make a temporary copy of the name, in case if the database gets relocated --- src/runtime/c/pgf/probspace.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/runtime/c/pgf/probspace.cxx b/src/runtime/c/pgf/probspace.cxx index 19ed03d56..1dea031f4 100644 --- a/src/runtime/c/pgf/probspace.cxx +++ b/src/runtime/c/pgf/probspace.cxx @@ -154,7 +154,9 @@ PgfProbspace probspace_delete_by_cat(PgfProbspace space, PgfText *cat, return Node::link(space,space->left,right); } else { - itor->fn(itor, &space->value.fun->name, space->value.fun.as_object(), err); + PgfText *name = textdup(&space->value.fun->name); + itor->fn(itor, name, space->value.fun.as_object(), err); + free(name); if (err->type != PGF_EXN_NONE) return 0; From 542a62775ae7b0fb5029dacfa5a2a4b393b5c6a8 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 09:37:05 +0200 Subject: [PATCH 140/162] change error message --- src/runtime/haskell/tests/typechecking.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/haskell/tests/typechecking.hs b/src/runtime/haskell/tests/typechecking.hs index 6db7b2314..3ed4439c6 100644 --- a/src/runtime/haskell/tests/typechecking.hs +++ b/src/runtime/haskell/tests/typechecking.hs @@ -24,7 +24,7 @@ main = do ,TestCase (assertInference "infer literal 3" gr (Right "String") "\"abc\"") ,TestCase (assertInference "infer meta 1" gr (Left "Cannot infer the type of a meta variable") "?") ,TestCase (assertInference "infer meta 2" gr (Right "N->N") "N>") - ,TestCase (assertInference "infer lambda" gr (Left "Cannot infer the type of a lambda abstraction") "\\x->x") + ,TestCase (assertInference "infer lambda" gr (Left "Cannot infer the type of a lambda variable") "\\x->x") ,TestCase (assertChecking "check fun 1" gr (Right "s") "s" "N->N") ,TestCase (assertChecking "check fun 2" gr (Right "s z") "s z" "N") ,TestCase (assertChecking "check fun 3" gr (Left "Types doesn't match") "s z" "N->N") From 76cc90e05ccde332efd5cce179e4250fa7c6398d Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 09:49:21 +0200 Subject: [PATCH 141/162] try switching to /opt/homebrew --- .github/workflows/build-majestic.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index 14b8c53d7..bc7b5e18c 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -179,8 +179,8 @@ jobs: with: name: libpgf-macos - run: | - sudo mv lib/* /usr/local/lib/ - sudo mv include/* /usr/local/include/ + sudo mv lib/* /opt/homebrew/lib/ + sudo mv include/* /opt/homebrew/include/ - name: Setup Haskell uses: haskell-actions/setup@v2 From 53fdd0f359c08765fd8244f171d3e83f1d26daa6 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 09:56:30 +0200 Subject: [PATCH 142/162] try to bump the GHC version --- .github/workflows/build-majestic.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index bc7b5e18c..11178c820 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -185,7 +185,7 @@ jobs: - name: Setup Haskell uses: haskell-actions/setup@v2 with: - ghc-version: 8 + ghc-version: 9 - name: Build & run testsuite working-directory: ./src/runtime/haskell @@ -197,8 +197,8 @@ jobs: runs-on: macOS-latest needs: macos-runtime env: - EXTRA_INCLUDE_DIRS: /usr/local/include - EXTRA_LIB_DIRS: /usr/local/lib + EXTRA_INCLUDE_DIRS: /opt/homebrew/include + EXTRA_LIB_DIRS: /opt/homebrew/lib MACOSX_DEPLOYMENT_TARGET: 11.0 steps: From 91a0571e51dc24217d0f06b4327fc8bae005af82 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 10:16:45 +0200 Subject: [PATCH 143/162] try more fiddling with macOS --- .github/workflows/build-majestic.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index 11178c820..644946e2f 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -190,7 +190,8 @@ jobs: - name: Build & run testsuite working-directory: ./src/runtime/haskell run: | - cabal test --extra-lib-dirs=/usr/local/lib + cabal v1-install --extra-lib-dirs=/opt/homebrew/lib --extra-include-dirs=/opt/homebrew/include + cabal test --extra-lib-dirs=/opt/homebrew/lib macos-python: name: Python (macOS) @@ -208,8 +209,8 @@ jobs: with: name: libpgf-macos - run: | - sudo mv lib/* /usr/local/lib/ - sudo mv include/* /usr/local/include/ + sudo mv lib/* /opt/homebrew/lib/ + sudo mv include/* /opt/homebrew/include/ - name: Install cibuildwheel run: | From 89bd7af8bd6883a91e8f95092e3de377bae4a1dd Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 10:31:50 +0200 Subject: [PATCH 144/162] try different settings for LD_LIBRARY_PATH on Linux and macOS --- .github/workflows/build-majestic.yml | 34 ++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index 644946e2f..4773321ff 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -2,9 +2,6 @@ name: Build majestic runtime on: push -env: - LD_LIBRARY_PATH: /usr/local/lib - jobs: linux-runtime: @@ -12,6 +9,8 @@ jobs: runs-on: ubuntu-latest container: image: quay.io/pypa/manylinux_2_28_x86_64 + env: + LD_LIBRARY_PATH: /usr/local/lib steps: - uses: actions/checkout@v7 @@ -36,6 +35,8 @@ jobs: name: Haskell (Linux) runs-on: ubuntu-latest needs: linux-runtime + env: + LD_LIBRARY_PATH: /usr/local/lib steps: - uses: actions/checkout@v7 @@ -78,6 +79,8 @@ jobs: name: Python (Linux) runs-on: ubuntu-latest needs: linux-runtime + env: + LD_LIBRARY_PATH: /usr/local/lib steps: - uses: actions/checkout@v7 @@ -139,6 +142,8 @@ jobs: macos-runtime: name: Runtime (macOS) runs-on: macOS-latest + env: + LD_LIBRARY_PATH: /opt/homebrew/lib steps: - uses: actions/checkout@v7 @@ -155,7 +160,7 @@ jobs: run: | glibtoolize autoreconf -i - ./configure + ./configure --prefix=/opt/homebrew make sudo make install @@ -164,13 +169,15 @@ jobs: with: name: libpgf-macos path: | - /usr/local/lib/libpgf* - /usr/local/include/pgf + /opt/homebrew/lib/libpgf* + /opt/homebrew/include/pgf macos-haskell: name: Haskell (macOS) runs-on: macOS-latest needs: macos-runtime + env: + LD_LIBRARY_PATH: /opt/homebrew/lib steps: - uses: actions/checkout@v7 @@ -187,17 +194,30 @@ jobs: with: ghc-version: 9 - - name: Build & run testsuite + - name: build and test the runtime working-directory: ./src/runtime/haskell run: | cabal v1-install --extra-lib-dirs=/opt/homebrew/lib --extra-include-dirs=/opt/homebrew/include cabal test --extra-lib-dirs=/opt/homebrew/lib + - name: build the compiler + working-directory: ./src/compiler + run: | + cabal v1-install + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: compiler-macos + path: | + ~/.cabal/bin/gf + macos-python: name: Python (macOS) runs-on: macOS-latest needs: macos-runtime env: + LD_LIBRARY_PATH: /opt/homebrew/lib EXTRA_INCLUDE_DIRS: /opt/homebrew/include EXTRA_LIB_DIRS: /opt/homebrew/lib MACOSX_DEPLOYMENT_TARGET: 11.0 From bb1e034daa3175372898ffd3b74f18fad64c53a9 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 10:51:26 +0200 Subject: [PATCH 145/162] try another way to set folders on macOS --- .github/workflows/build-majestic.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index 4773321ff..1c00e579a 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -178,6 +178,7 @@ jobs: needs: macos-runtime env: LD_LIBRARY_PATH: /opt/homebrew/lib + CPATH: /opt/homebrew/include:$CPATH steps: - uses: actions/checkout@v7 @@ -197,7 +198,7 @@ jobs: - name: build and test the runtime working-directory: ./src/runtime/haskell run: | - cabal v1-install --extra-lib-dirs=/opt/homebrew/lib --extra-include-dirs=/opt/homebrew/include + cabal v1-install cabal test --extra-lib-dirs=/opt/homebrew/lib - name: build the compiler From 7dc8e99fd1ef94b050dddaf904f8ef19659ef006 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 11:01:14 +0200 Subject: [PATCH 146/162] yet another variant --- .github/workflows/build-majestic.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index 1c00e579a..f4afc8cda 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -198,7 +198,7 @@ jobs: - name: build and test the runtime working-directory: ./src/runtime/haskell run: | - cabal v1-install + cabal v1-install --extra-lib-dirs=/opt/homebrew/lib --extra-include-dirs=/opt/homebrew/include cabal test --extra-lib-dirs=/opt/homebrew/lib - name: build the compiler From 937d072dc46a8085155d96a793a6e756d45545d8 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 11:12:49 +0200 Subject: [PATCH 147/162] install alex & happy on macOS --- .github/workflows/build-majestic.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index f4afc8cda..91f692a2c 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -195,6 +195,10 @@ jobs: with: ghc-version: 9 + - name: Install Haskell build tools + run: | + cabal v1-install alex happy + - name: build and test the runtime working-directory: ./src/runtime/haskell run: | From 52c556b784b259a00bc07b60f917feae65657e8e Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 11:25:31 +0200 Subject: [PATCH 148/162] try using virtual environment for python on macOS --- .github/workflows/build-majestic.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index 91f692a2c..1847f02c6 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -237,9 +237,14 @@ jobs: sudo mv lib/* /opt/homebrew/lib/ sudo mv include/* /opt/homebrew/include/ + - name: Create Python virtual environment + run: | + python3 -m venv .venv + .venv/bin/python -m pip install --upgrade pip + - name: Install cibuildwheel run: | - python3 -m pip install git+https://github.com/joerick/cibuildwheel.git@main + .venv/bin/python -m pip install git+https://github.com/joerick/cibuildwheel.git@main - name: Install and test bindings env: @@ -247,7 +252,7 @@ jobs: CIBW_TEST_COMMAND: "pytest {project}/src/runtime/python" CIBW_SKIP: "pp* cp36* cp37* cp38* cp39*" run: | - python3 -m cibuildwheel src/runtime/python --output-dir wheelhouse + .venv/bin/python -m cibuildwheel src/runtime/python --output-dir wheelhouse - uses: actions/upload-artifact@v4 with: From df1c729bfe48bffe518af8d97841b9160e15e884 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 11:29:50 +0200 Subject: [PATCH 149/162] bump the deployment target --- .github/workflows/build-majestic.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index 1847f02c6..5d56d17d8 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -225,7 +225,7 @@ jobs: LD_LIBRARY_PATH: /opt/homebrew/lib EXTRA_INCLUDE_DIRS: /opt/homebrew/include EXTRA_LIB_DIRS: /opt/homebrew/lib - MACOSX_DEPLOYMENT_TARGET: 11.0 + MACOSX_DEPLOYMENT_TARGET: 15.0 steps: - uses: actions/checkout@v7 From f55f1cb569b5b8c67255e011744feb89026ed66b Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 11:33:57 +0200 Subject: [PATCH 150/162] macOS deployment target=26 --- .github/workflows/build-majestic.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index 5d56d17d8..33ff86f62 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -225,7 +225,7 @@ jobs: LD_LIBRARY_PATH: /opt/homebrew/lib EXTRA_INCLUDE_DIRS: /opt/homebrew/include EXTRA_LIB_DIRS: /opt/homebrew/lib - MACOSX_DEPLOYMENT_TARGET: 15.0 + MACOSX_DEPLOYMENT_TARGET: 26.0 steps: - uses: actions/checkout@v7 From b57686ca9f9b9f65d7d0f93590a3f70bfe414982 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 11:39:36 +0200 Subject: [PATCH 151/162] started an action to compile gf on Windows --- .github/workflows/build-majestic.yml | 39 ++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index 33ff86f62..2ac5d4090 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -331,6 +331,45 @@ jobs: ${{runner.temp}}/msys64/mingw64/lib/libpgf* ${{runner.temp}}/msys64/mingw64/include/pgf + windows-haskell: + name: Haskell (Windows) + runs-on: windows-latest + needs: mingw64-runtime + + steps: + - uses: actions/checkout@v7 + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: libpgf-windows + + - name: Setup Haskell + uses: haskell-actions/setup@v2 + with: + ghc-version: 8 + + - name: Install Haskell build tools + run: | + cabal v1-install alex happy + + - name: build and test the runtime + working-directory: ./src/runtime/haskell + run: | + cabal v1-install + cabal test + + - name: build the compiler + working-directory: ./src/compiler + run: | + cabal v1-install + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: compiler-linux + path: | + ~/.cabal/bin/gf + windows-python: name: Python (Windows) runs-on: windows-latest From 95df6b34c93a7e7e7ba86d4738db4bf50191c0a5 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 11:50:06 +0200 Subject: [PATCH 152/162] try to set up paths for Windows --- .github/workflows/build-majestic.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index 2ac5d4090..957587ff9 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -335,6 +335,8 @@ jobs: name: Haskell (Windows) runs-on: windows-latest needs: mingw64-runtime + env: + PATH: %HOME%/lib;%PATH% steps: - uses: actions/checkout@v7 @@ -355,7 +357,7 @@ jobs: - name: build and test the runtime working-directory: ./src/runtime/haskell run: | - cabal v1-install + cabal v1-install --extra-lib-dirs=lib --extra-include-dirs=include cabal test - name: build the compiler @@ -366,7 +368,7 @@ jobs: - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: compiler-linux + name: compiler-windows path: | ~/.cabal/bin/gf From 85fc1fa43e6f1cfc87a0da0b70848fa7ddd1af7c Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 11:53:44 +0200 Subject: [PATCH 153/162] another attempt to set up path --- .github/workflows/build-majestic.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index 957587ff9..c1b3d43b5 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -336,7 +336,7 @@ jobs: runs-on: windows-latest needs: mingw64-runtime env: - PATH: %HOME%/lib;%PATH% + PATH: $HOME/lib:$PATH steps: - uses: actions/checkout@v7 From ffd25c0371dd4aa17975375ed7589ea2d2ac945e Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 11:58:48 +0200 Subject: [PATCH 154/162] just remove the path for now --- .github/workflows/build-majestic.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index c1b3d43b5..2b2f2683d 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -335,8 +335,6 @@ jobs: name: Haskell (Windows) runs-on: windows-latest needs: mingw64-runtime - env: - PATH: $HOME/lib:$PATH steps: - uses: actions/checkout@v7 From 02e86112e3876fad6c20476103f8e70bbf29f2e7 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 12:31:39 +0200 Subject: [PATCH 155/162] try relative path --- .github/workflows/build-majestic.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index 2b2f2683d..3f2d575df 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -355,7 +355,7 @@ jobs: - name: build and test the runtime working-directory: ./src/runtime/haskell run: | - cabal v1-install --extra-lib-dirs=lib --extra-include-dirs=include + cabal v1-install --extra-lib-dirs=../../../lib --extra-include-dirs=../../../include cabal test - name: build the compiler From 90d664ef8ae34bcf56adf544304451e0dd83274b Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 12:42:27 +0200 Subject: [PATCH 156/162] yet another attempt --- .github/workflows/build-majestic.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index 3f2d575df..c09667503 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -355,7 +355,7 @@ jobs: - name: build and test the runtime working-directory: ./src/runtime/haskell run: | - cabal v1-install --extra-lib-dirs=../../../lib --extra-include-dirs=../../../include + cabal v1-install --extra-lib-dirs=${{ github.workspace }}/lib --extra-include-dirs=${{ github.workspace }}/include cabal test - name: build the compiler From 3e7edbba1e094c2b283d21083092eae8ecf996cd Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 13:11:48 +0200 Subject: [PATCH 157/162] try fliping to backslash --- .github/workflows/build-majestic.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index c09667503..7de908cad 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -355,7 +355,7 @@ jobs: - name: build and test the runtime working-directory: ./src/runtime/haskell run: | - cabal v1-install --extra-lib-dirs=${{ github.workspace }}/lib --extra-include-dirs=${{ github.workspace }}/include + cabal v1-install --extra-lib-dirs=${{ github.workspace }}\lib --extra-include-dirs=${{ github.workspace }}\include cabal test - name: build the compiler From f8c471adb477b7575a8624603430aa637d2e9b67 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 13:27:24 +0200 Subject: [PATCH 158/162] trying to debug the folder structure --- .github/workflows/build-majestic.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index 7de908cad..79f1902fc 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -355,6 +355,8 @@ jobs: - name: build and test the runtime working-directory: ./src/runtime/haskell run: | + dir ${{ github.workspace }}\lib + dir ${{ github.workspace }}\include cabal v1-install --extra-lib-dirs=${{ github.workspace }}\lib --extra-include-dirs=${{ github.workspace }}\include cabal test From 2958bf2a0eb620211afc0c7224d12325370fe1d8 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 13:42:26 +0200 Subject: [PATCH 159/162] try installing libpgf in GHC's own MinGW --- .github/workflows/build-majestic.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index 79f1902fc..e22323ba7 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -348,6 +348,16 @@ jobs: with: ghc-version: 8 + - name: Install libpgf for GHC + shell: pwsh + run: | + $ghcLibDir = ghc --print-libdir + $ghcRoot = Split-Path (Split-Path $ghcLibDir -Parent) -Parent + + Copy-Item "${{ github.workspace }}\lib\*" "$ghcRoot\mingw\lib\" -Force + Copy-Item "${{ github.workspace }}\include\pgf" "$ghcRoot\mingw\include\" -Recurse -Force + Copy-Item "${{ github.workspace }}\bin\libpgf-0.dll" "$ghcRoot\bin\" -Force + - name: Install Haskell build tools run: | cabal v1-install alex happy @@ -355,9 +365,7 @@ jobs: - name: build and test the runtime working-directory: ./src/runtime/haskell run: | - dir ${{ github.workspace }}\lib - dir ${{ github.workspace }}\include - cabal v1-install --extra-lib-dirs=${{ github.workspace }}\lib --extra-include-dirs=${{ github.workspace }}\include + cabal v1-install cabal test - name: build the compiler From 268944e00988a2309c2972b226fb602e07cfa166 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 13:43:32 +0200 Subject: [PATCH 160/162] fix formatting --- .github/workflows/build-majestic.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index e22323ba7..a1ca7b988 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -349,14 +349,14 @@ jobs: ghc-version: 8 - name: Install libpgf for GHC - shell: pwsh - run: | - $ghcLibDir = ghc --print-libdir - $ghcRoot = Split-Path (Split-Path $ghcLibDir -Parent) -Parent + shell: pwsh + run: | + $ghcLibDir = ghc --print-libdir + $ghcRoot = Split-Path (Split-Path $ghcLibDir -Parent) -Parent - Copy-Item "${{ github.workspace }}\lib\*" "$ghcRoot\mingw\lib\" -Force - Copy-Item "${{ github.workspace }}\include\pgf" "$ghcRoot\mingw\include\" -Recurse -Force - Copy-Item "${{ github.workspace }}\bin\libpgf-0.dll" "$ghcRoot\bin\" -Force + Copy-Item "${{ github.workspace }}\lib\*" "$ghcRoot\mingw\lib\" -Force + Copy-Item "${{ github.workspace }}\include\pgf" "$ghcRoot\mingw\include\" -Recurse -Force + Copy-Item "${{ github.workspace }}\bin\libpgf-0.dll" "$ghcRoot\bin\" -Force - name: Install Haskell build tools run: | From 3658c5063ce6e4f24c8ac12b3f68fec2dc5e5fdb Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 14:01:42 +0200 Subject: [PATCH 161/162] another variant --- .github/workflows/build-majestic.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index a1ca7b988..c690be109 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -352,11 +352,10 @@ jobs: shell: pwsh run: | $ghcLibDir = ghc --print-libdir - $ghcRoot = Split-Path (Split-Path $ghcLibDir -Parent) -Parent - Copy-Item "${{ github.workspace }}\lib\*" "$ghcRoot\mingw\lib\" -Force - Copy-Item "${{ github.workspace }}\include\pgf" "$ghcRoot\mingw\include\" -Recurse -Force - Copy-Item "${{ github.workspace }}\bin\libpgf-0.dll" "$ghcRoot\bin\" -Force + Copy-Item "${{ github.workspace }}\lib\*" "$ghcLibDir\..\mingw\lib\" -Force + Copy-Item "${{ github.workspace }}\include\pgf" "$ghcLibDir\..\mingw\include\" -Recurse -Force + Copy-Item "${{ github.workspace }}\bin\libpgf-0.dll" "$ghcLibDir\..\bin\" -Force - name: Install Haskell build tools run: | From 056b91ba2bb30b615e1f71626f9d1a921876f181 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 9 Sep 2026 14:13:09 +0200 Subject: [PATCH 162/162] instead libpgf copy all dlls --- .github/workflows/build-majestic.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-majestic.yml b/.github/workflows/build-majestic.yml index c690be109..2dd842a96 100644 --- a/.github/workflows/build-majestic.yml +++ b/.github/workflows/build-majestic.yml @@ -355,7 +355,7 @@ jobs: Copy-Item "${{ github.workspace }}\lib\*" "$ghcLibDir\..\mingw\lib\" -Force Copy-Item "${{ github.workspace }}\include\pgf" "$ghcLibDir\..\mingw\include\" -Recurse -Force - Copy-Item "${{ github.workspace }}\bin\libpgf-0.dll" "$ghcLibDir\..\bin\" -Force + Copy-Item "${{ github.workspace }}\bin\*" "$ghcLibDir\..\bin\" -Force - name: Install Haskell build tools run: |