-
Notifications
You must be signed in to change notification settings - Fork 13
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
Import module collisions #235
base: main
Are you sure you want to change the base?
Changes from 73 commits
e1ec3aa
4e81af3
a2deafb
7ff377a
1b2cfaf
f05cbdd
2776226
3d80c84
6145e02
434712c
34e6618
c8bb2d1
eca7cdd
97b9c39
2659da7
c3e9aca
22cc526
ddbae71
cd2ec79
b114741
2f4992c
19d4a65
9bc6837
09c85cb
6020508
33f7d48
2a2c42a
c5f48c6
826eb0c
5acadd1
27269e6
7d61d81
0aa6bb3
d42d258
a430af3
375baae
6847ca9
0350baf
da753a5
f886311
fc54de8
fbeca95
c3232d4
8ce0e24
f20862f
ecc51cd
2e2e322
d5cf3f2
c3e1d6d
0df2511
9824c51
ba66015
237b0e5
e10b206
9662f04
f66afdc
41d3b82
1349a7c
86c50d6
6062341
d1ff39b
c6b38d2
24b33ba
55373d2
1387304
1d9fed9
4330552
0d17d3a
65ab88c
bbaa2d7
97eff1d
a335c8f
ecac589
6756e1d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* Gibbon program. */ | ||
|
||
#include "gibbon_rts.h" | ||
|
||
#include <assert.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <stdint.h> | ||
#include <inttypes.h> | ||
#include <math.h> | ||
#include <stdbool.h> | ||
#include <string.h> | ||
#include <time.h> | ||
#include <alloca.h> | ||
#include <sys/mman.h> | ||
#include <sys/resource.h> | ||
#include <sys/stat.h> | ||
#include <unistd.h> | ||
#include <fcntl.h> | ||
#include <stdarg.h> | ||
#include <errno.h> | ||
#include <uthash.h> | ||
|
||
#ifdef _WIN64 | ||
#include <windows.h> | ||
#endif | ||
|
||
#ifdef _GIBBON_POINTER | ||
#include <gc.h> | ||
#endif | ||
|
||
#ifdef _GIBBON_PARALLEL | ||
#include <cilk/cilk.h> | ||
#include <cilk/cilk_api.h> | ||
#endif | ||
|
||
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
* Program starts here | ||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
*/ | ||
|
||
typedef struct GibIntProd_struct { | ||
GibInt field0; | ||
} GibIntProd; | ||
GibInt add1(GibInt x_1_10_13); | ||
typedef enum { | ||
GibInt_T, | ||
GibFloat_T, | ||
GibSym_T, | ||
GibBool_T, | ||
GibVector_T, | ||
GibList_T, | ||
GibCursor_T, | ||
} GibDatatype; | ||
void info_table_initialize(void) | ||
{ | ||
int error = gib_info_table_initialize(7); | ||
|
||
if (error < 0) { | ||
fprintf(stderr, "Couldn't initialize info table, errorno=%d", error); | ||
exit(1); | ||
} | ||
|
||
GibDatatype field_tys[0]; | ||
|
||
gib_info_table_finalize(); | ||
} | ||
void symbol_table_initialize(void) | ||
{ } | ||
GibInt add1(GibInt x_1_10_13) | ||
{ | ||
GibInt flt_15 = x_1_10_13 + 1; | ||
|
||
return flt_15; | ||
} | ||
int main(int argc, char **argv) | ||
{ | ||
int init_0 = gib_init(argc, argv); | ||
|
||
info_table_initialize(); | ||
symbol_table_initialize(); | ||
|
||
GibInt fltAppE_11_12 = add1(0); | ||
GibInt tmp_app_14 = add1(fltAppE_11_12); | ||
|
||
printf("%ld", tmp_app_14); | ||
printf("\n"); | ||
return 0; | ||
|
||
int exit_1 = gib_exit(); | ||
|
||
return exit_1; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* Gibbon program. */ | ||
|
||
#include "gibbon_rts.h" | ||
|
||
#include <assert.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <stdint.h> | ||
#include <inttypes.h> | ||
#include <math.h> | ||
#include <stdbool.h> | ||
#include <string.h> | ||
#include <time.h> | ||
#include <alloca.h> | ||
#include <sys/mman.h> | ||
#include <sys/resource.h> | ||
#include <sys/stat.h> | ||
#include <unistd.h> | ||
#include <fcntl.h> | ||
#include <stdarg.h> | ||
#include <errno.h> | ||
#include <uthash.h> | ||
|
||
#ifdef _WIN64 | ||
#include <windows.h> | ||
#endif | ||
|
||
#ifdef _GIBBON_POINTER | ||
#include <gc.h> | ||
#endif | ||
|
||
#ifdef _GIBBON_PARALLEL | ||
#include <cilk/cilk.h> | ||
#include <cilk/cilk_api.h> | ||
#endif | ||
|
||
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
* Program starts here | ||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
*/ | ||
|
||
typedef enum { | ||
GibInt_T, | ||
GibFloat_T, | ||
GibSym_T, | ||
GibBool_T, | ||
GibVector_T, | ||
GibList_T, | ||
GibCursor_T, | ||
} GibDatatype; | ||
void info_table_initialize(void) | ||
{ | ||
int error = gib_info_table_initialize(7); | ||
|
||
if (error < 0) { | ||
fprintf(stderr, "Couldn't initialize info table, errorno=%d", error); | ||
exit(1); | ||
} | ||
|
||
GibDatatype field_tys[0]; | ||
|
||
gib_info_table_finalize(); | ||
} | ||
void symbol_table_initialize(void) | ||
{ } | ||
int main(int argc, char **argv) | ||
{ | ||
int init_0 = gib_init(argc, argv); | ||
|
||
info_table_initialize(); | ||
symbol_table_initialize(); | ||
|
||
int exit_1 = gib_exit(); | ||
|
||
return exit_1; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* Gibbon program. */ | ||
|
||
#include "gibbon_rts.h" | ||
|
||
#include <assert.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <stdint.h> | ||
#include <inttypes.h> | ||
#include <math.h> | ||
#include <stdbool.h> | ||
#include <string.h> | ||
#include <time.h> | ||
#include <alloca.h> | ||
#include <sys/mman.h> | ||
#include <sys/resource.h> | ||
#include <sys/stat.h> | ||
#include <unistd.h> | ||
#include <fcntl.h> | ||
#include <stdarg.h> | ||
#include <errno.h> | ||
#include <uthash.h> | ||
|
||
#ifdef _WIN64 | ||
#include <windows.h> | ||
#endif | ||
|
||
#ifdef _GIBBON_POINTER | ||
#include <gc.h> | ||
#endif | ||
|
||
#ifdef _GIBBON_PARALLEL | ||
#include <cilk/cilk.h> | ||
#include <cilk/cilk_api.h> | ||
#endif | ||
|
||
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
* Program starts here | ||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
*/ | ||
|
||
typedef enum { | ||
GibInt_T, | ||
GibFloat_T, | ||
GibSym_T, | ||
GibBool_T, | ||
GibVector_T, | ||
GibList_T, | ||
GibCursor_T, | ||
} GibDatatype; | ||
void info_table_initialize(void) | ||
{ | ||
int error = gib_info_table_initialize(7); | ||
|
||
if (error < 0) { | ||
fprintf(stderr, "Couldn't initialize info table, errorno=%d", error); | ||
exit(1); | ||
} | ||
|
||
GibDatatype field_tys[0]; | ||
|
||
gib_info_table_finalize(); | ||
} | ||
void symbol_table_initialize(void) | ||
{ } | ||
int main(int argc, char **argv) | ||
{ | ||
int init_0 = gib_init(argc, argv); | ||
|
||
info_table_initialize(); | ||
symbol_table_initialize(); | ||
|
||
int exit_1 = gib_exit(); | ||
|
||
return exit_1; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,3 +32,4 @@ demo/*.c | |
demo/*.exe | ||
gibbon-compiler/examples/parallel/data/*.txt | ||
*.log.hs | ||
*.log |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Build profile: -w ghc-9.2.8 -O1 | ||
In order, the following will be built (use -v for more details): | ||
- gibbon-0.3 (lib) (file src/Gibbon/Language/Syntax.hs changed) | ||
- gibbon-0.3 (exe:test-gibbon-examples) (dependency rebuilt) | ||
- gibbon-0.3 (exe:gibbon) (dependency rebuilt) | ||
Preprocessing library for gibbon-0.3.. | ||
Building library for gibbon-0.3.. | ||
[16 of 61] Compiling Gibbon.NewL2.Syntax ( src/Gibbon/NewL2/Syntax.hs, /home/timmy/git/gibbon/dist-newstyle/build/x86_64-linux/ghc-9.2.8/gibbon-0.3/build/Gibbon/NewL2/Syntax.o, /home/timmy/git/gibbon/dist-newstyle/build/x86_64-linux/ghc-9.2.8/gibbon-0.3/build/Gibbon/NewL2/Syntax.dyn_o ) [Gibbon.Language.Syntax changed] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Build profile: -w ghc-9.2.8 -O1 | ||
In order, the following will be built (use -v for more details): | ||
- gibbon-0.3 (lib) (file src/Gibbon/HaskellFrontend.hs changed) | ||
- gibbon-0.3 (exe:test-gibbon-examples) (dependency rebuilt) | ||
- gibbon-0.3 (exe:gibbon) (dependency rebuilt) | ||
Preprocessing library for gibbon-0.3.. | ||
Building library for gibbon-0.3.. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
module Add where | ||
data Tree = Leaf Int | Node Tree Tree | ||
|
||
add1 :: Tree -> Tree | ||
add1 t = case t of | ||
Leaf x -> Leaf (x + 1) | ||
Node x1 x2 -> Node (add1 x1) (add1 x2) | ||
Node x1 x2 -> Node (Add.add1 x1) (Add.add1 x2) | ||
|
||
main :: Tree | ||
main = add1 (Node (Leaf 1) (Leaf 2)) | ||
gibbon_main :: Tree | ||
gibbon_main = Add.add1 (Node (Leaf 1) (Leaf 2)) | ||
Comment on lines
-8
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was annoyed that this example doesn't compile too. But does this change fix it? I seem to remember that |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module AddTree where | ||
data Tree = Node Tree Tree | Leaf Int | ||
|
||
sum :: Tree -> Int | ||
sum t = | ||
case t of | ||
Leaf v -> v | ||
Node l r -> (sum l) + (sum r) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module Addone where | ||
import AddTree | ||
|
||
add :: Tree -> Tree | ||
add t = case t of | ||
Leaf x -> Leaf (x + 1) | ||
Node x1 x2 -> Node (add x1) (add x2) | ||
|
||
sub :: Tree -> Tree | ||
sub t = case t of | ||
Leaf x -> Leaf (x - 1) | ||
Node x1 x2 -> Node (sub x1) (sub x2) | ||
|
||
gibbon_main :: Tree | ||
gibbon_main = add (Node (Leaf 1) (Leaf 2)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module Addtwo where | ||
import AddTree | ||
|
||
add :: Tree -> Tree | ||
add t = case t of | ||
Leaf x -> Leaf (x + 2) | ||
Node x1 x2 -> Node (add x1) (add x2) | ||
|
||
sub :: Tree -> Tree | ||
sub t = case t of | ||
Leaf x -> Leaf (x - 2) | ||
Node x1 x2 -> Node (sub x1) (sub x2) | ||
|
||
gibbon_main :: Tree | ||
gibbon_main = add (Node (Leaf 1) (Leaf 2)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
9 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module AllThreeImportModifications where | ||
import qualified Addtwo as T (add) | ||
import qualified Addone as O (add) | ||
import AddTree as Tree (sum, Node, Leaf) | ||
|
||
gibbon_main = sum (T.add (O.add (Tree.Node (Tree.Leaf 1) (Tree.Leaf 2)))) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
9 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module ImportAliased where | ||
import qualified Addtwo as T | ||
import qualified Addone as O | ||
import AddTree as Tree | ||
|
||
gibbon_main = sum (T.add (O.add (Tree.Node (Tree.Leaf 1) (Tree.Leaf 2)))) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
9 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module ImportQualified where | ||
import qualified Addtwo | ||
import qualified Addone | ||
import AddTree | ||
|
||
gibbon_main = sum (Addtwo.add (Addone.add (Node (Leaf 1) (Leaf 2)))) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
5 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module ImportQualifiedAndSpecified where | ||
import qualified Addtwo (add) | ||
import qualified Addone (sub) | ||
import AddTree | ||
|
||
gibbon_main = sum (Addtwo.add (Addone.sub (Node (Leaf 1) (Leaf 2)))) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
5 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module ImportSpecified where | ||
import Addtwo (add) | ||
import Addone (sub) | ||
import AddTree | ||
|
||
gibbon_main = sum (add (sub (Node (Leaf 1) (Leaf 2)))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The *.log files don't belong in the repo.