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

Update hello world example / fix compiler for hello.glow #191

Closed
kwannoel opened this issue Sep 22, 2021 · 17 comments
Closed

Update hello world example / fix compiler for hello.glow #191

kwannoel opened this issue Sep 22, 2021 · 17 comments

Comments

@kwannoel
Copy link
Contributor

In GitLab by @kwanzknoel on May 25, 2021, 17:34

hello.glow Taken from glow-lang.org tutorial.

#lang glow

@interaction([A, B])
let publishHello = () => {
    @A let ha = "Hello, B, I am A. How do you do?";
    publish! A -> ha;

    @B let hb = "Hello, A. I am B. How do YOU do?";
    publish! B -> hb;
};

Fails with the following trace:

> ./glow start-interaction --backtrace
Connecting to the Cardano EVM Devnet at https://rpc-evm.portal.dev.cardano.org/ ...

Choose application:
1) buy_sig
2) coin_flip
3) hello
4) rps_simple
Enter number
> 3
Glow v0.1.0-128-g062f6c1 on Gerbil-ethereum v0.0-260-gb151403, Gerbil-persist v0.0-19-g75d4c45, Gerbil-crypto ef0ef55, Gerbil-poo 5b2290f, Gerbil-utils v0.0-316-g3c748ed, Gerbil v0.16-178-g17fbcb95, Gambit v4.9.3-1389-g55b21ed9
In thread primordial:
0  mukn/glow/compiler/parse/parse#stat->sexpr 
1  mukn/glow/compiler/parse/parse#stat->sexpr 
2  mukn/glow/compiler/parse/parse#stat->sexpr 
3  mukn/glow/compiler/parse/parse#fsl->module 
4  mukn/glow/compiler/parse/parse#fsl->module 
5  mukn/glow/compiler/multipass#run-pass 
6  foldl1                               
7  mukn/glow/compiler/multipass#run-passes__% 
8  mukn/glow/cli/interaction#compile-contract 
9  mukn/glow/cli/interaction#start-interaction/generate-agreement__% 
10 mukn/glow/cli/interaction#start-interaction__% 
11 ##dynamic-env-bind                   
12 ##call-with-values                   
13 clan/exit#call-print-exit            
14 ##dynamic-env-bind                   
15 ##start-main                         
16 ##kernel-handlers                    
*** ERROR IN mukn/glow/compiler/parse/parse#stat->sexpr -- No clause matching #f

UPDATED Trace (after https://gitlab.com/mukn/glow/-/merge_requests/143):

> ./glow start-interaction --backtrace
Connecting to the Cardano EVM Devnet at https://rpc-evm.portal.dev.cardano.org/ ...

Choose application:
1) buy_sig
2) coin_flip
3) hello
4) invalid
5) rps_simple
6) simple-funds-transfer.solution
7) tmp
8) transfer
Enter number
> 
Glow v0.1.0-139-gf8dcd32 on Gerbil-ethereum v0.0-260-gb151403, Gerbil-persist v0.0-19-g75d4c45, Gerbil-crypto ef0ef55, Gerbil-poo 5b2290f, Gerbil-utils v0.0-316-g3c748ed, Gerbil v0.16-178-g17fbcb95, Gambit v4.9.3-1389-g55b21ed9
In thread primordial:
0  mukn/glow/compiler/alpha-convert/env#symbol-refer 
1  mukn/glow/compiler/alpha-convert/alpha-convert#alpha-convert-expr 
2  gx#stx-map1                          
3  mukn/glow/compiler/alpha-convert/alpha-convert#alpha-convert-expr 
4  mukn/glow/compiler/alpha-convert/alpha-convert#alpha-convert-body 
5  mukn/glow/compiler/alpha-convert/alpha-convert#alpha-convert-body 
6  mukn/glow/compiler/alpha-convert/alpha-convert#alpha-convert-body 
7  mukn/glow/compiler/alpha-convert/alpha-convert#alpha-convert-body 
8  mukn/glow/compiler/alpha-convert/alpha-convert#alpha-convert-body 
9  mukn/glow/compiler/alpha-convert/alpha-convert#alpha-convert-body 
10 mukn/glow/compiler/alpha-convert/alpha-convert#alpha-convert-body 
11 mukn/glow/compiler/alpha-convert/alpha-convert#alpha-convert-body 
12 mukn/glow/compiler/alpha-convert/alpha-convert#ac-expr-function 
13 mukn/glow/compiler/alpha-convert/alpha-convert#ac-stmt-def 
14 mukn/glow/compiler/alpha-convert/alpha-convert#ac-stmt-atinteraction 
15 mukn/glow/compiler/alpha-convert/alpha-convert#alpha-convert-stmts 
16 mukn/glow/compiler/alpha-convert/alpha-convert#alpha-convert 
17 ##dynamic-env-bind                   
18 ##dynamic-env-bind                   
19 ##dynamic-env-bind                   
20 mukn/glow/compiler/multipass#run-pass 
21 foldl1                               
22 mukn/glow/compiler/multipass#run-passes__% 
23 mukn/glow/cli/interaction#compile-contract 
24 mukn/glow/cli/interaction#start-interaction/generate-agreement__% 
25 mukn/glow/cli/interaction#start-interaction__% 
26 ##dynamic-env-bind                   
27 ##call-with-values                   
28 clan/exit#call-print-exit            
29 ##dynamic-env-bind                   
30 ##start-main                         
31 ##kernel-handlers                    
*** ERROR IN mukn/glow/compiler/alpha-convert/env#symbol-refer -- alpha-convert "unbound identifier" publish!

We should either update the example / fix the compiler to handle this.

@kwannoel
Copy link
Contributor Author

In GitLab by @kwanzknoel on May 25, 2021, 17:35

changed the description

@kwannoel
Copy link
Contributor Author

In GitLab by @kwanzknoel on May 25, 2021, 17:35

changed title from Update example / fix compiler for hello.glow to Update {+hello world +}example / fix compiler for hello.glow

@kwannoel
Copy link
Contributor Author

In GitLab by @kwanzknoel on May 25, 2021, 17:43

changed the description

@kwannoel
Copy link
Contributor Author

In GitLab by @kwanzknoel on May 25, 2021, 23:04

parser dump

function stmt list:
(#<annotationStatement #158 attribute: #<attribute #159 id: #<identifier #160 name: "interaction">
  arguments: (#<compound-expression #161 expressions: (#<identifier #162 name: "A"> #<identifier #163 name: "B">)>)> stat: #<function-declaration #164 identifier: #<identifier #165 name: "publishHello">
  params: (#f) type: #f
  expr: #<block-expression #166 body: #<body #167 statements: (#<annotationStatement #168 attribute: #<attribute #169 id: #<identifier #170 name: "A"> arguments: #f> stat: #<assignment-statement #171 identifier: #<identifier #172 name: "ha"> type: #f expr: #<string-literal #173 value: (DoubleQuoteStringLiteral "Hello, B, I am A. How do you do?")>>> #<publish-statement #174 id: #<identifier #175 name: "A"> expr: (#<identifier #176 name: "ha">)> #<annotationStatement #177 attribute: #<attribute #178 id: #<identifier #179 name: "B"> arguments: #f> stat: #<assignment-statement #180 identifier: #<identifier #181 name: "hb"> type: #f expr: #<string-literal #182 value: (DoubleQuoteStringLiteral "Hello, A. I am B. How do YOU do?")>>> #<publish-statement #183 id: #<identifier #184 name: "B"> expr: (#<identifier #185 name: "hb">)>) expr: #f>>>>)

Notice that the parser produces: params: (#f), from the expression: let publishHello = () => {.

I am guessing this should be empty list: () instead.

@kwannoel
Copy link
Contributor Author

In GitLab by @kwanzknoel on May 25, 2021, 23:20

parser dump for buy_sig.glow

...
params: (#<param-data #190 id: #<identifier #191 name: "digest"> typ: #<type-name #192 id: "Digest">> #<param-data #193 id: #<identifier #194 name: "price"> typ: #<type-name #195 id: "Nat">>) 

@kwannoel
Copy link
Contributor Author

In GitLab by @kwanzknoel on May 26, 2021, 01:54

mentioned in merge request !143

@kwannoel
Copy link
Contributor Author

In GitLab by @fahree on May 26, 2021, 20:18

mentioned in commit c3e4f8e

@kwannoel
Copy link
Contributor Author

In GitLab by @kwanzknoel on May 26, 2021, 22:38

changed the description

@kwannoel
Copy link
Contributor Author

In GitLab by @kwanzknoel on May 26, 2021, 22:39

changed the description

1 similar comment
@kwannoel
Copy link
Contributor Author

In GitLab by @kwanzknoel on May 26, 2021, 22:39

changed the description

@kwannoel
Copy link
Contributor Author

In GitLab by @kwanzknoel on May 26, 2021, 22:41

Fixed empty params function, but there are still errors when compilation the function body. Have updated the trace.

@kwannoel
Copy link
Contributor Author

In GitLab by @kwanzknoel on May 26, 2021, 22:41

changed the description

@kwannoel
Copy link
Contributor Author

In GitLab by @kwanzknoel on May 26, 2021, 23:12

assigned to @AlexKnauth

@kwannoel
Copy link
Contributor Author

In GitLab by @ApolloUnicorn on May 26, 2021, 23:12

assigned to @kwanzknoel

@kwannoel
Copy link
Contributor Author

In GitLab by @kwanzknoel on May 27, 2021, 16:01

Just so everyone is aware, @AlexKnauth is the one actively working on this. He will be more likely to pinpoint / solve the issue as he wrote the related code.

@kwannoel
Copy link
Contributor Author

In GitLab by @AlexKnauth on Jun 1, 2021, 03:03

mentioned in merge request !144

@kwannoel
Copy link
Contributor Author

In GitLab by @AlexKnauth on Jun 1, 2021, 06:44

mentioned in commit 83b8b12

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

No branches or pull requests

1 participant