hacking gfschool.grammaticalframework.org/2013/slides/gregoire...git? bene ts i more people know git...

21
Hacking GF Gr´ egoire D´ etrez August 29, 2013

Upload: others

Post on 02-Aug-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Hacking GFschool.grammaticalframework.org/2013/slides/gregoire...Git? bene ts I more people know git than darcs I more, easier to use (GUI) tools I Github! I code & issues at the same

Hacking GF

Gregoire Detrez

August 29, 2013

Page 2: Hacking GFschool.grammaticalframework.org/2013/slides/gregoire...Git? bene ts I more people know git than darcs I more, easier to use (GUI) tools I Github! I code & issues at the same

Getting the code

With darcs

darcs get --lazy http://www.grammaticalframework.org/ GF

With git

git clone https://github.com/GrammaticalFramework/GF.git

As a zip archive

https://github.com/GrammaticalFramework/GF/archive/

master.zip

Page 3: Hacking GFschool.grammaticalframework.org/2013/slides/gregoire...Git? bene ts I more people know git than darcs I more, easier to use (GUI) tools I Github! I code & issues at the same

Preparing your computer

To be able to build gf, you will need the following:

I ghc & cabal (Recommended: Haskell Platform, 2012.4.0.0 orlater)

I the haskeline

Debian (Ubuntu)

apt-get install haskell-platform libghc-haskeline-dev

Fedora

yum install haskell-platform ghc-haskeline-devel

Page 4: Hacking GFschool.grammaticalframework.org/2013/slides/gregoire...Git? bene ts I more people know git than darcs I more, easier to use (GUI) tools I Github! I code & issues at the same

Building gfInstall dependencies

cabal install --only-dependencies

Configure

cabal configure

Compile

cabal build rgl-none

Tips: use cabal-dev instead of cabal for a sandboxeddevelopement environment

Page 5: Hacking GFschool.grammaticalframework.org/2013/slides/gregoire...Git? bene ts I more people know git than darcs I more, easier to use (GUI) tools I Github! I code & issues at the same

Source files

I Runtime (haskel, used by the compiler):src/runtime/haskell

I Shell & compiler: src/compiler

Page 6: Hacking GFschool.grammaticalframework.org/2013/slides/gregoire...Git? bene ts I more people know git than darcs I more, easier to use (GUI) tools I Github! I code & issues at the same

Compiler overview

Dependency analysis -> Parsing -> Renaming -> GrammarChecking -> Partial Evaluation -> PMCFG generation

(from https://code.google.com/p/grammatical-framework/wiki/CompilationPhases)

Page 7: Hacking GFschool.grammaticalframework.org/2013/slides/gregoire...Git? bene ts I more people know git than darcs I more, easier to use (GUI) tools I Github! I code & issues at the same

Dependency analysis

I traverses the dependencies of the top modulesI determines which modules need to be compiledI . . . and in what orderI circular dependences are not allowed and are reported as error

location: src/compiler/GF/Compile/ReadFiles.hs

(getAllFiles)

Page 8: Hacking GFschool.grammaticalframework.org/2013/slides/gregoire...Git? bene ts I more people know git than darcs I more, easier to use (GUI) tools I Github! I code & issues at the same

Parsing

I parse the .gf source filesI implemented using halex & happy

location: ‘src/compiler/GF/Grammar/{Parser.y,lexer/Lexer.x}

Page 9: Hacking GFschool.grammaticalframework.org/2013/slides/gregoire...Git? bene ts I more people know git than darcs I more, easier to use (GUI) tools I Github! I code & issues at the same

Renaming

I Ambiguous references are reported as warnings. The compilerpicks the first choice and tries to compile with it.

location: src/compiler/GF/Compile/Rename.hs

Page 10: Hacking GFschool.grammaticalframework.org/2013/slides/gregoire...Git? bene ts I more people know git than darcs I more, easier to use (GUI) tools I Github! I code & issues at the same

Grammar Checking

I check that for every lin there is a corresponding fun or datadefinition

I check that for cat there is a corresponding lincatI type checking

location: src/compiler/GF/Compile/CheckGrammar.hs

Page 11: Hacking GFschool.grammaticalframework.org/2013/slides/gregoire...Git? bene ts I more people know git than darcs I more, easier to use (GUI) tools I Github! I code & issues at the same

Partial Evaluation

I missing lindef declarations are automatically generatedI evaluation of the oper using call-by-name

location: ‘src/compiler/GF/Compile/Compute/Concrete.hs’

Page 12: Hacking GFschool.grammaticalframework.org/2013/slides/gregoire...Git? bene ts I more people know git than darcs I more, easier to use (GUI) tools I Github! I code & issues at the same

PMCFG generation

I convert GF rules to PMCFG rulesI this is where the gfo files are generated(?)

location src/compiler/GF/Compile/GeneratePMCFG.hs

Page 13: Hacking GFschool.grammaticalframework.org/2013/slides/gregoire...Git? bene ts I more people know git than darcs I more, easier to use (GUI) tools I Github! I code & issues at the same

Resources

Wiki

https://code.google.com/p/grammatical-framework/wiki/

Issue tracker

https:

//code.google.com/p/grammatical-framework/issues/list

GF Developer guide

http:

//www.grammaticalframework.org/doc/gf-developers.html

Page 14: Hacking GFschool.grammaticalframework.org/2013/slides/gregoire...Git? bene ts I more people know git than darcs I more, easier to use (GUI) tools I Github! I code & issues at the same

The future

Page 15: Hacking GFschool.grammaticalframework.org/2013/slides/gregoire...Git? bene ts I more people know git than darcs I more, easier to use (GUI) tools I Github! I code & issues at the same

C runtime

Location src/runtime/c

I python bindingI java binding (WIP)I . . . other bindings?

Page 16: Hacking GFschool.grammaticalframework.org/2013/slides/gregoire...Git? bene ts I more people know git than darcs I more, easier to use (GUI) tools I Github! I code & issues at the same

Build server

Figure : Jenkins

Page 17: Hacking GFschool.grammaticalframework.org/2013/slides/gregoire...Git? bene ts I more people know git than darcs I more, easier to use (GUI) tools I Github! I code & issues at the same

Build server

Figure : Jenkins gf page

Page 18: Hacking GFschool.grammaticalframework.org/2013/slides/gregoire...Git? bene ts I more people know git than darcs I more, easier to use (GUI) tools I Github! I code & issues at the same

Build server

Figure : RGL status

Page 19: Hacking GFschool.grammaticalframework.org/2013/slides/gregoire...Git? bene ts I more people know git than darcs I more, easier to use (GUI) tools I Github! I code & issues at the same

Git?

benefits

I more people know git than darcsI more, easier to use (GUI) toolsI Github!

I code & issues at the same placeI good exposureI lots of young excited codersI facilitating casual contributions using github’s pull requests

Page 20: Hacking GFschool.grammaticalframework.org/2013/slides/gregoire...Git? bene ts I more people know git than darcs I more, easier to use (GUI) tools I Github! I code & issues at the same

Git?

Separate repository for the RGL

I sugested on the MLI more contributors to the RGL than the haskell code

Page 21: Hacking GFschool.grammaticalframework.org/2013/slides/gregoire...Git? bene ts I more people know git than darcs I more, easier to use (GUI) tools I Github! I code & issues at the same

Git?

Wishlist? Suggestions?