-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LPGF: Linearisation-only PGF format #103
Draft
johnjcamilleri
wants to merge
118
commits into
master
Choose a base branch
from
lpgf
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains 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
…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
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.