LPGF: Linearisation-only PGF format#103
Draft
johnjcamilleri wants to merge 118 commits intomasterfrom
Draft
Conversation
…ome hardcoded examples
stack test :lpgf
Still contains some hardcoded values, missing cases. I notice now that LPGF and Canonical GF are almost identical, so maybe we don't need a new LPGF format, just a linearization-only runtime which works on canonical grammars. The argument for keeping LGPF is that it would be optimized for size and speed.
…sBull, `ASg kind.g`).
Also an unhandled Projection case
This avoids a lot of conversion back and forth between Strings and ByteStrings
# Conflicts: # gf.cabal # src/compiler/GF/Compile/GrammarToCanonical.hs # src/compiler/GF/Grammar/Canonical.hs # src/compiler/GF/Infra/Option.hs
# Conflicts: # gf.cabal # src/compiler/GF/Grammar/Canonical.hs
# Conflicts: # gf.cabal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduction
Recently I've been working on resurrecting on old idea, which is adding support for a PGF file format which only supports linearisation, since this is actually quite a common use for GF. The motivations are:
The format itself is described in section 2 of the paper:
(where it is confusingly called "PGF"; what we call "PGF" today is really "PMCFG", section 3 of the same paper).
Progress so far
This draft pull request contains the following:
src/runtime/haskell/LPGF.hs) which is correct w.r.t. the PGF and PGF2 implementations, with the exception of:src/compiler/GF/Compiler/GrammarToLPGF.hs), which can be used in the expected way:gf --make --output-format=lpgf ...Notable ommisions
Performance
Unfortunately, so far I haven't been able to live up to all the performance goals:
So my current focus is on trying to improve the performance of the LPGF compiler, with which I am struggling. I have done what I can with improving the data structures and algorithms used, but I am rather inexperienced with tinkering with strictness and other Haskell performance tuning. If anyone has more expertise in this area then please let me know and I can get more specific about where the bottlenecks are and what I've tried already. Until then, this pull request can remain open and be where any major updates to this project are made.