Skip to content
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

[POC] run Elpi code in lambdapi #418

Draft
wants to merge 25 commits into
base: master
Choose a base branch
from
Draft

[POC] run Elpi code in lambdapi #418

wants to merge 25 commits into from

Conversation

gares
Copy link

@gares gares commented Jun 9, 2020

do not merge this is a POC to be discussed at a seminar on the 18th

TODO (hopefully for the 18th):

  • support Terms.Meta in the HOAS encoding using Elpi's unification variables
  • from Terms.term Conversion.t to (Terms.term,Env.t,_) ContextualConversion.t
  • bind Typing.infer(_constr) and Eval.eq_modulo

@fblanqui
Copy link
Member

fblanqui commented Jun 9, 2020

Ouah. That's great @gares . Thank you for digging into the code of Lambdapi !

@gares
Copy link
Author

gares commented Jun 10, 2020

CI seems to be failing because of "sanity_check" but it does not seem to have much to do with my code (locally it prints messages about files I did not touch). Is it expected?

@fblanqui
Copy link
Member

Yes:

18:39 ~/lambdapi (elpi) make sanity_check
In src/core/ctxt.ml, line 12 more than 78 characters...
In src/core/elpi_lambdapi.ml, line 53 more than 78 characters...
In src/core/elpi_lambdapi.ml, line 95 more than 78 characters...
In src/core/elpi_lambdapi.ml, line 99 more than 78 characters...
In src/core/elpi_lambdapi.ml, line 175 more than 78 characters...
In src/core/elpi_lambdapi.ml, line 259 more than 78 characters...
In src/core/elpi_lambdapi.ml, line 263 more than 78 characters...

Please run tools/git_hook_helper.sh to have the following pre-commit hook:

#!/bin/sh
if [ ! -z "$(make sanity_check)" ]; then
    echo "Sanity check failed."
    exit 1
fi

@gares
Copy link
Author

gares commented Jun 10, 2020

I did set it up, but then I could not commit anything. If I run the script locally I get

gares@ollypat:~/work-area/lambdapi$ make sanity_check 
In src/cli/lambdapi.ml, line 30 more than 78 characters...
In src/core/basics.ml, line 30 more than 78 characters...
In src/core/builtin.ml, line 10 more than 78 characters...
... many other files, including mine, ....

here line 30 of src/cli/lambdapi.ml has 79 chars according to my editor.

Anyway, I'll fix my file, I did not spot it in the sea of errors it prints here

@fblanqui
Copy link
Member

Well, 79>78 indeed ;-) But that's strange we do not get the same files! Do you use gawk? I have GNU Awk 4.1.4. Could you please give the complete result of make sanity_check too?

@gares
Copy link
Author

gares commented Jun 10, 2020

Well spotted, I've no idea why my ubuntu has this variant of awk (by default)

gares@ollypat:~/work-area/lambdapi$ dpkg -l | grep awk
ii  mawk                                       1.3.3-17ubuntu3                                  amd64        a pattern scanning and text processing language

I've installed gawk, it now works

@gabrielhdt
Copy link
Member

It's not the first time it happens, perhaps we should check the awk version with a awk --version | grep GNU or something of the kind...

@fblanqui
Copy link
Member

Why not simply calling gawk explicitly instead of awk?

@fblanqui
Copy link
Member

tools/git_hook_helper.sh could also check that gawk exists

@fblanqui
Copy link
Member

Fixed in f2c363c

@@ -478,12 +478,28 @@ let scope =
a type (defaults to [false]). No {b new} metavariables may appear in
[t], but metavariables in the image of [mok] may be used. The function
[mok] defaults to the function constant to [None] *)
let scope_term : ?typ:bool -> ?mok:(int -> meta option) ->
let scope_term: ?typ:bool -> ?mok:(int -> meta option) ->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove the diff here.

bool -> sig_state -> env -> p_term -> term =
fun ?(typ=false) ?(mok=fun _ -> None) m_term_prv ss env t ->
let md = M_Term {m_term_meta_of_key=mok; m_term_prv} in
Bindlib.unbox (scope ~typ 0 md ss env t)

let scope_term_w_pats: ?typ:bool -> ?mok:(int -> meta option) ->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing explanation of the function.

@@ -18,6 +18,11 @@ val scope_term :
?mok:(int -> meta option) ->
bool -> sig_state -> env -> p_term -> term

val scope_term_w_pats :
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing explanation of the function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants