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

merging master with new-ponyrt #106

Merged
merged 194 commits into from
Mar 3, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
194 commits
Select commit Hold shift + click to select a range
b53c648
Runtime types generated for passive classes, futures and streams
EliasC Jan 30, 2015
f09585c
Proper calls to future_mk generated
EliasC Feb 3, 2015
e94f089
Fixed bug where future_trace got stuck
EliasC Feb 3, 2015
38a999b
Fixed naming in set library
EliasC Feb 4, 2015
256019a
Removed comments
EliasC Feb 4, 2015
770b997
Fixed naming in closure lib
EliasC Feb 4, 2015
4779cd4
Tracing of closures
EliasC Feb 4, 2015
c822ce0
GC does not need to block on futures
EliasC Feb 4, 2015
6e8c8de
Replace old PonyRT with new PonyRT.
albertnetymk Feb 4, 2015
10ddaef
Add libencore in the build process.
albertnetymk Feb 4, 2015
bedc73d
Use encore_arg_t in closure.
albertnetymk Feb 4, 2015
10990a4
Add encore.h.
albertnetymk Feb 4, 2015
09861e2
Encore programs now start by calling encore_start
TobiasWrigstad Feb 4, 2015
1e01036
Preferential Attachment experiment
TobiasWrigstad Feb 4, 2015
1bd7831
Moved declarations to header file
TobiasWrigstad Feb 4, 2015
6660676
Bugfix and msg_id in encore.c/h
EliasC Feb 4, 2015
bf853ae
Generate new structs for messages.
Feb 4, 2015
3fd16d0
Added C AST-node for casting Name to Type
EliasC Feb 4, 2015
bf45a13
Added C AST node for arrows
EliasC Feb 4, 2015
ec48ce1
Generating proper types for classes
EliasC Feb 4, 2015
f41b8a8
Merge pull request #71 from kaeluka/new-ponyrt
TobiasWrigstad Feb 4, 2015
fb5b9dc
Proper typedefs
TobiasWrigstad Feb 4, 2015
4a40cd8
Added encore wrappers to create and alloc
TobiasWrigstad Feb 4, 2015
6d53ee4
Fixing stupid speling bug
TobiasWrigstad Feb 4, 2015
dcdb76e
Fix also applied to corresponding C file
TobiasWrigstad Feb 4, 2015
abd45bb
Added required imports
TobiasWrigstad Feb 4, 2015
b3be649
Use encore lib when allocating
EliasC Feb 4, 2015
fdfae64
Add platform and encore head files in release.
albertnetymk Feb 4, 2015
4cc1935
Merge branch 'new-ponyrt' of https://github.com/parapluu/mylittlepony…
EliasC Feb 4, 2015
42dc23c
Added proper ifndef/def/endif
TobiasWrigstad Feb 4, 2015
4339dae
Foo
TobiasWrigstad Feb 4, 2015
3fd48d6
Removed some actor specific things from shared
EliasC Feb 4, 2015
025112d
Added ENCORE_ACTIVE and ENCORE_PRIMITIVE
TobiasWrigstad Feb 4, 2015
969260f
No need to memset after encore_alloc
EliasC Feb 4, 2015
2160dde
Refactoring of naming functions
EliasC Feb 4, 2015
d875e61
Started fixing the dispatch function
EliasC Feb 4, 2015
cdc27f8
Add libfuture.
albertnetymk Feb 4, 2015
fe98073
Add libstream.
albertnetymk Feb 4, 2015
9d9e04c
Fixed bug where normal and one way message IDs had the same names
EliasC Feb 4, 2015
3beedfa
Moved message types to header
EliasC Feb 4, 2015
8603cb7
Fixed bug due to some reverted changes
TobiasWrigstad Feb 4, 2015
909df86
Add encore/actor.
albertnetymk Feb 4, 2015
13c0102
Merge branch 'new-ponyrt' of github.com:parapluu/mylittlepony into ne…
TobiasWrigstad Feb 4, 2015
af0f193
Fixing int printing
TobiasWrigstad Feb 4, 2015
d3fd508
Change code generation for method calls to use the new arg structs.
Feb 4, 2015
5639837
Enumerate fields of arg structs
Feb 4, 2015
a4e3f70
Confused by pull request
TobiasWrigstad Feb 4, 2015
97ed43d
Merge branch 'kaeluka-new-ponyrt' into new-ponyrt
TobiasWrigstad Feb 4, 2015
c8386ea
Milestone: hello world works!!!
TobiasWrigstad Feb 4, 2015
32de9ad
Use `-fms-extensions` when build generated C code.
albertnetymk Feb 4, 2015
6014b22
Remove `-Wno-unknown-attributes`.
albertnetymk Feb 4, 2015
401c754
Explicit downcast to exact actor type inside dispatch fn.
albertnetymk Feb 4, 2015
6c195cb
Added futures back in the lib folder
TobiasWrigstad Feb 4, 2015
4604253
Commented out all TODOs in future.c with ///
TobiasWrigstad Feb 4, 2015
7fb7ff9
Unpacking argument structs
TobiasWrigstad Feb 4, 2015
5629dcf
Calling the proper GC functions on receiving
TobiasWrigstad Feb 4, 2015
ab350c0
Placeholders for tracing in futures (partial)
TobiasWrigstad Feb 5, 2015
573a903
Cleanup in aisle Shared.hs
EliasC Feb 5, 2015
6ecef01
Use enums for future ID, closure ID etc.
EliasC Feb 5, 2015
3df4d3a
Use ENCORE_ACTIVE and ENCORE_PRIMITIVE
EliasC Feb 5, 2015
1fdb777
Added Extern C AST node
EliasC Feb 5, 2015
d003bd3
Include all runtime types (as extern) in the header
EliasC Feb 5, 2015
605883d
Changed order in header so that class types come before message types
EliasC Feb 5, 2015
c9ae0c5
Added dispatch function stub for passive classes
EliasC Feb 5, 2015
80f2c59
Fixed bug about message types
TobiasWrigstad Feb 5, 2015
91ac738
Got rid of some warnings in the trace functions
EliasC Feb 5, 2015
65529e8
Got rid of warnings when creating active objects
EliasC Feb 5, 2015
a10b080
Got rid of warning in the dispatch function
EliasC Feb 5, 2015
fb18bea
remove warnings
Feb 5, 2015
373c95b
Use `pony_alloc_msg` to allocate method argument structs.
Feb 5, 2015
3f57bad
Merge pull request #73 from kaeluka/new-ponyrt
TobiasWrigstad Feb 5, 2015
9861af9
We should use encore_arg_t rather than pony_arg_t
EliasC Feb 5, 2015
38caffb
Removed non-compiling line from Expr.hs
EliasC Feb 5, 2015
400c696
Streams now have proper cases (modulo GC) in the dispatch function
EliasC Feb 5, 2015
0a877bf
Name bug due to strings
TobiasWrigstad Feb 5, 2015
588d386
Added tracing of futures on receive
TobiasWrigstad Feb 5, 2015
67eedb7
Use new argument field names in dispatch function.
Feb 5, 2015
1d8656e
Suppress warnings about missing attributes (`-Wno-attributes`)
EliasC Feb 5, 2015
168a60a
Merge pull request #74 from kaeluka/new-ponyrt
TobiasWrigstad Feb 5, 2015
9f3df43
Fixed . to -> access on msg structs
TobiasWrigstad Feb 5, 2015
6b2e315
Removed superflous arguments to pony_sendv
TobiasWrigstad Feb 5, 2015
299c841
Fixed bugs in message sends
TobiasWrigstad Feb 5, 2015
bd6acf5
Unifying name generation for msg_type_t and msg IDs
EliasC Feb 5, 2015
8bf0895
Fixed bug that broke message sends
EliasC Feb 5, 2015
b8c62f0
minor casts
Feb 5, 2015
ef6ec39
Added GC on send (partial)
TobiasWrigstad Feb 5, 2015
950d69b
Added todos
TobiasWrigstad Feb 5, 2015
7a1c331
Removed arefs
TobiasWrigstad Feb 5, 2015
c9512a4
Fixed bug where the value of MSG_IDs collided in the dispatch function
EliasC Feb 5, 2015
f30f5d7
Got rid of the last warnings (aka. minor casts II)
EliasC Feb 5, 2015
8312515
remove the use of futures in two tests that do not test them
Feb 5, 2015
f1c6756
Added tracing of futures to message sending
TobiasWrigstad Feb 5, 2015
9b9f800
Boyscouting
EliasC Feb 5, 2015
bf2f569
Completely got rid of varaccess_this_to_aref
EliasC Feb 5, 2015
44a9097
Install futures into the pony_arg_ts. Also unboyscouted.
Feb 5, 2015
cdfd4db
Added an init call on the mutex
TobiasWrigstad Feb 5, 2015
5c27d9d
Futures now store pony_arg_t rather than void*
EliasC Feb 3, 2015
fd7d32b
Use `encore_alloc` instead of `pony_alloc`.
albertnetymk Feb 5, 2015
e34e331
Add `encore_actor_run_hook` in `actor.c`.
albertnetymk Feb 5, 2015
f132559
Cleanup of unused code
EliasC Feb 5, 2015
3b7a4cd
Removed ctx_wrapper as it was already in encore.h
TobiasWrigstad Feb 5, 2015
27ec834
Use `encore.h` in `future.c`.
albertnetymk Feb 5, 2015
f136969
Updated preferential attachment to use new names
TobiasWrigstad Feb 5, 2015
6d719e1
Added trace functions to mr.enc
TobiasWrigstad Feb 5, 2015
2c2cc12
Fixed bug in translation of await and suspend
EliasC Feb 5, 2015
04004b2
Updated mr.enc to new Encore syntax, added hack
TobiasWrigstad Feb 6, 2015
0134498
Compilation now produces a makefile in the c source directory
EliasC Feb 6, 2015
bf8f9bc
Explain `./actor` in `encore/README.md`.
albertnetymk Feb 6, 2015
471247b
Merge pull request #78 from parapluu/new-ponyrt-makefile
Feb 6, 2015
0427e8b
Renamed hot fix method more aptly
TobiasWrigstad Feb 6, 2015
85dc85d
Added extern actor_curren() decl to future.c
TobiasWrigstad Feb 6, 2015
48e28d9
Added support for tracing futures in argument positions on message sends
TobiasWrigstad Feb 6, 2015
ac64e29
Added tracing of closures on message send/recv
TobiasWrigstad Feb 6, 2015
fa8122a
Using the hack in mr.enc
TobiasWrigstad Feb 6, 2015
6132622
Calculating proper pool index for msg alloc
TobiasWrigstad Feb 6, 2015
e968eb9
Backported trace function for futures
TobiasWrigstad Feb 6, 2015
f6977f1
Fixed space.
Feb 6, 2015
b54e825
Support for importing modules from other directories, specified using…
Feb 3, 2015
6bbea2b
Added warning message for possibly ambiguous imports.
Feb 4, 2015
c137aac
Added runtime library for arrays
EliasC Feb 3, 2015
4bfeacf
Parser support for array types
EliasC Feb 3, 2015
d7fc737
Typechecking support for array types
EliasC Feb 3, 2015
9464282
Translation of array types
EliasC Feb 4, 2015
88a2a23
Translation of array expressions
EliasC Feb 4, 2015
51aec36
Adapted array lib to changes in the new branch
EliasC Feb 7, 2015
acaa1e1
Adding missing files
Feb 7, 2015
a04356d
Cleanup
EliasC Feb 7, 2015
fb25238
Merge pull request #82 from parapluu/new-ponyrt-modules
EliasC Feb 7, 2015
cc7f468
Added a test for the array
EliasC Feb 9, 2015
be7cb98
Added documentation about arrays
EliasC Feb 9, 2015
1c993df
Merge pull request #81 from parapluu/features/arrays-new-pony-rt
Feb 9, 2015
1b67451
Add archives after all the object files for the linker.
albertnetymk Feb 9, 2015
bbc124f
Add `std=gnu11` to use loop initial declaration.
albertnetymk Feb 9, 2015
49d049e
Add `-std=gnu11` for generated C code.
albertnetymk Feb 9, 2015
a567a9f
Place archive files after object file in generated Makefile.
albertnetymk Feb 9, 2015
fb447f7
Reuse configs from Pony project in `premake4.lua`.
albertnetymk Feb 9, 2015
d190d1e
Set `CONFIG=release` by default.
albertnetymk Feb 9, 2015
be118fd
Add coroutine support. Disable by default for performance reason.
albertnetymk Feb 9, 2015
e47ead4
Add future support with only `get`.
albertnetymk Feb 9, 2015
2581301
Add future chaining. No tracing.
albertnetymk Feb 10, 2015
a2422b8
Disable coroutine and future.
albertnetymk Feb 11, 2015
130c7f1
add _XOPEN_SOURCE in header file to get the right offset in eager str…
Feb 11, 2015
c602b9b
forgot to add the context.h in actor
Feb 11, 2015
53cce3b
Merge pull request #84 from parapluu/new-ponyrt-eager
Feb 11, 2015
817f9d1
boyscout: fix naming convention in Header.hs
Feb 11, 2015
19e065f
Fixed bug where target of an ArraySize was never translated
EliasC Feb 12, 2015
02c5887
Boyscouting: natural -> integer
EliasC Feb 12, 2015
43bb839
Removed the grammar in `Parser.hs`
EliasC Feb 12, 2015
da2fbec
Bodies of methods with void type can have any type
EliasC Feb 12, 2015
15c0473
Improved error messages
EliasC Feb 12, 2015
5ca75eb
Added `bench` rule to generated Makefile
EliasC Feb 13, 2015
b9bf49a
Merge pull request #86 from parapluu/features/void-methods
Feb 13, 2015
8e3cd81
Removed superfluous library inclusion in Makefile.hs
EliasC Feb 13, 2015
983df0d
Introduce peer keyword
Feb 16, 2015
c42ab3b
Test for peer keyword
Feb 16, 2015
dea3a87
Merge pull request #89 from kaeluka/new-ponyrt
EliasC Feb 16, 2015
251359f
Breathe keyword
Feb 16, 2015
7eed5fc
Merge pull request #90 from kaeluka/new-ponyrt
EliasC Feb 16, 2015
dbef49b
Add future tracing support.
albertnetymk Feb 17, 2015
1bb55a7
change arguments from void* to encore_arg_t (not finished)
Feb 13, 2015
cf325ec
extend context with a class table information
Feb 13, 2015
ac6a897
add `each` semantics to Par T
Feb 13, 2015
e4dc512
change par t : t -> int
Feb 17, 2015
50eca7e
add semantics of `sync` in specific par t types
Feb 17, 2015
19593ac
bank account example using par t types
Feb 17, 2015
97daa30
update names of par t types due to name clash with C code
Feb 18, 2015
7637f6d
clean up method names
Feb 18, 2015
53a4a50
Merge pull request #95 from kikofernandez/feature/party
Feb 18, 2015
a9e60f0
Mandelbrot benchmark
TheGrandmother Feb 18, 2015
7826d00
Add lazy strategy for ucontext.
albertnetymk Feb 18, 2015
5bdd13b
fix uses of encore_arg_t in functions, expressions and classes
Feb 16, 2015
313b189
fix encore_arg_t for closure
Feb 19, 2015
96f1581
Merge pull request #96 from TheGrandmother/mandelbrot
Feb 19, 2015
870c8d6
Merge pull request #97 from kikofernandez/features/encore_arg_t
EliasC Feb 19, 2015
6f3e375
Put the actor at the beginning of the queue on resuming.
albertnetymk Feb 20, 2015
2a6c653
Some documentation improvements for review
Feb 20, 2015
8527f41
t pushMerge branch 'new-ponyrt' of https://github.com/parapluu/encore…
Feb 20, 2015
461dbca
fixed minor syntax error
TheGrandmother Feb 20, 2015
893d71e
Merge pull request #99 from TheGrandmother/new-ponyrt
albertnetymk Feb 20, 2015
40d2c96
Added short documentation of the module system
TheGrandmother Feb 21, 2015
3b41902
Merge pull request #101 from TheGrandmother/module-doc
Feb 21, 2015
b89f904
Updated and repaired the author list
Feb 21, 2015
294e8fc
boyscout: clean up ootr example
Feb 22, 2015
8ed0150
Merge pull request #102 from kikofernandez/bugfix/ootr
albertnetymk Feb 22, 2015
5cb9a5d
Add actors with empty msg queue to dormant list.
albertnetymk Feb 22, 2015
2141606
Ensure uniqueness when adding to dormant list.
albertnetymk Feb 22, 2015
64db65b
Suppress warnings about unused values
EliasC Feb 23, 2015
e988d92
Fixed bug regarding polymorphism
EliasC Feb 23, 2015
e0c63a1
Added proper encore_arg_t wrapping for streams
EliasC Feb 23, 2015
e968517
Merge work-stealing bugfix from upstream.
albertnetymk Feb 23, 2015
b459295
clean up threadring folder
Feb 27, 2015
113a823
boyscout: add word documentation to the documentation
Feb 27, 2015
816e03e
rename agent to worker in threadring ootr
Feb 27, 2015
3137b12
Merge branch 'new-ponyrt'
Feb 27, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 23 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ ENCOREC=dist/build/encorec/encorec

RUNTIME_DIR=$(SRC_DIR)/runtime

CLOSURE_INC=$(RUNTIME_DIR)/closure/closure.h
CLOSURE_LIB=$(RUNTIME_DIR)/pony/bin/debug/libclosure.a
STREAM_INC=$(RUNTIME_DIR)/stream/stream.h
STREAM_LIB=$(RUNTIME_DIR)/pony/bin/debug/libstream.a
CONFIG=debug
CONFIG=release

RELEASE_DIR=release
INC_DIR=$(RELEASE_DIR)/inc
Expand All @@ -27,6 +25,7 @@ test: encorec

SET_DIR=$(RUNTIME_DIR)/set
FUTURE_DIR=$(RUNTIME_DIR)/future
ENCORE_DIR=$(RUNTIME_DIR)/encore
doc: cabal-config
make -C doc/encore/
cabal haddock --all
Expand All @@ -39,24 +38,40 @@ $(INC_DIR):
$(LIB_DIR):
mkdir -p $(LIB_DIR)

PLATFORM_INC=$(RUNTIME_DIR)/pony/inc/platform
PONY_INC=$(RUNTIME_DIR)/pony/inc/pony
PONY_LIB=$(RUNTIME_DIR)/pony/bin/debug/libpony.a
PONY_LIB=$(RUNTIME_DIR)/pony/bin/$(CONFIG)/libpony.a
FUTURE_INC=$(FUTURE_DIR)/future.h
FUTURE_LIB=$(RUNTIME_DIR)/pony/bin/debug/libfuture.a
FUTURE_LIB=$(RUNTIME_DIR)/pony/bin/$(CONFIG)/libfuture.a
SET_INC=$(SET_DIR)/set.h
SET_LIB=$(RUNTIME_DIR)/pony/bin/debug/libset.a
SET_LIB=$(RUNTIME_DIR)/pony/bin/$(CONFIG)/libset.a
ENCORE_INC=$(ENCORE_DIR)/encore.h
ENCORE_LIB=$(RUNTIME_DIR)/pony/bin/$(CONFIG)/libencore.a
CLOSURE_INC=$(RUNTIME_DIR)/closure/closure.h
CLOSURE_LIB=$(RUNTIME_DIR)/pony/bin/$(CONFIG)/libclosure.a
STREAM_INC=$(RUNTIME_DIR)/stream/stream.h
STREAM_LIB=$(RUNTIME_DIR)/pony/bin/$(CONFIG)/libstream.a
ARRAY_INC=$(RUNTIME_DIR)/array/array.h
ARRAY_LIB=$(RUNTIME_DIR)/pony/bin/$(CONFIG)/libarray.a

pony: dirs $(PONY_INC)
make -C $(SRC_DIR) pony
cp -r $(PLATFORM_INC) $(INC_DIR)
cp -r $(PONY_INC) $(INC_DIR)
cp -r $(SET_INC) $(INC_DIR)
cp -r $(FUTURE_INC) $(INC_DIR)
cp -r $(CLOSURE_INC) $(INC_DIR)
cp -r $(STREAM_INC) $(INC_DIR)
cp -r $(ENCORE_INC) $(INC_DIR)
cp -r $(ARRAY_INC) $(INC_DIR)
cp -r $(PONY_LIB) $(LIB_DIR)
cp -r $(FUTURE_LIB) $(LIB_DIR)
cp -r $(CLOSURE_LIB) $(LIB_DIR)
cp -r $(ENCORE_LIB) $(LIB_DIR)
cp -r $(STREAM_LIB) $(LIB_DIR)
cp -r $(SET_LIB) $(LIB_DIR)

# cp -r $(SET_LIB) $(LIB_DIR)
cp -r $(ARRAY_LIB) $(LIB_DIR)

clean:
cabal clean
Expand Down
4 changes: 2 additions & 2 deletions doc/encore/index.scrbl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#lang scribble/manual

@title[#:version "0.1"]{Encore Programming Language}
@title[#:version "0.45"]{Encore Programming Language Documentation}

@author{The UpScale Team}
@author["Stephan Brandauer" "Elias Castegren" "Dave Clarke" "Kiko Fernandez" "Henrik Sommerland" "Tobias Wrigstad" "Albert Yang"]

@include-section["lang/getting-started/index.scrbl"]
@include-section["lang/introduction/index.scrbl"]
Expand Down
1 change: 1 addition & 0 deletions doc/encore/lang/getting-started/index.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ Running @code{encorec foo.enc} will typecheck the source and produce the executa
@item{@code{-clang} -- Use clang to build the executable (default)}
@item{@code{-AST} -- Output the parsed AST as text to foo.AST}
@item{@code{-TypedAST} -- Output the typechecked AST as text to foo.TAST}
@item{@code{-I path1:path2:...} -- Directories in which to look for modules. (Not needed for modules which are in the same folder as the file being compiled.)}
]

For instance, we might want to keep the intermediate C-files:
Expand Down
42 changes: 42 additions & 0 deletions doc/encore/lang/semantics/index.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,48 @@ repeat i <- 5
print("i={}\n",i)
}|

@section{Arrays}
For each type @code{T} there is a corresponding array type
@code{[T]}. For example, @code{[int]} is the type of arrays of
integers. You create a new array by writing @code{new [T](n)},
where @code{n} is the length of the array. An array has a fixed
size and can not be dynamically extended or shrunk.

You access an array by using standard bracket notation
@code{a[i]}. This is also how assignment into arrays is written.
You get the size of an array by putting the array within bars
@code{|a|}. You can also create array literals by writing a comma
separated list of expressions within brackets @code{[1, 2, 1+2]}.
This short example uses all features of arrays:

@codeblock|{
class Main
def bump(arr : [int]) : void
repeat i <- |arr|
arr[i] = arr[i] + 1

def main() : void{
let a = [1,2,3] in {
this.bump(a);
repeat i <- |a|
print a[i];
let b = new [int](3) in {
b[0] = 0;
b[1] = a[0];
b[2] = 42 - 19;
}
}
}
}|

The expected output is

@codeblock|{
2
3
4
}|

@section{Classes}

Classes in @tt{encore} have fields and methods. There is no
Expand Down
9 changes: 8 additions & 1 deletion doc/encore/lang/syntax/grammar.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ This section introduces the Encore grammar by using the BNF-grammar notation and
@; Definition of my keywords
@(encore/keyword open-paren "(")
@(encore/keyword close-paren ")")
@(encore/keyword open-bracket "[")
@(encore/keyword close-bracket "]")
@(encore/keyword bar "|")
@(encore/keyword open-c "{")
@(encore/keyword close-c "}")
@(encore/keyword equal "=")
Expand Down Expand Up @@ -196,6 +199,9 @@ This section introduces the Encore grammar by using the BNF-grammar notation and
@seq[get Expr]
@seq[new Type open-paren Arguments close-paren]
@seq[new Type]
@seq[Expr open-bracket Expr close-bracket]
@seq[open-bracket Expr @elem{, ...} close-bracket]
@seq[bar Expr bar]
null
true
false
Expand Down Expand Up @@ -229,7 +235,8 @@ This section introduces the Encore grammar by using the BNF-grammar notation and
string int bool void RefType
@seq[Fut Type]
@seq[Par Type]
@seq[open-paren Type close-paren])
@seq[open-paren Type close-paren]
@seq[open-bracket Type close-bracket])

(list Types
@alt[
Expand Down
38 changes: 38 additions & 0 deletions doc/encore/lang/syntax/index.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,44 @@ Encore language.

@include-section{grammar.scrbl}

@section{Module system}
As of now encore supports a rudimentary module system. The keywork used to import
modules is @code{import}.

Here follows a trivial example of usage of the module system.

File @code{Lib.enc}:
@codeblock|{
class Foo:
def boo():void {
print "^-^"
}

}|

File @code{Bar.enc}:
@codeblock|{
import Lib

class Main:
def main():void {
let
f = new Foo
in{
f.boo();
}
}

}|

Here the file @code{Bar.enc} imports @code{Lib.enc} and can thus access the class @code{Foo}.

To import files from different directories one needs to use the @code{-I path} argument for the compiler.

As of now the module system has no notion of namespaces so all imported objects needs to have unique names.
There is also no support for cyclic imports and no "include guards" so it's up to the programmer
to ensure that each file is only imported once.

@;@section{Keywords}
@;Keywords are special words used by the Encore language and they have special meaning.
@;In Encore, we have the following keywords:
Expand Down
7 changes: 7 additions & 0 deletions experiments/mandelbrot/Erlang-Hipe/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
PLOT_SIZE = 16000
TIME = /usr/bin/time -f '%C\nwall-time: %E\nuser-time: %U \nsystem-time: %S\nload: %P'
all:
erlc +native +"{hipe, [o3]}" mandelbrot.erl
run:
erl -smp enable -noshell -run mandelbrot main $(PLOT_SIZE)

48 changes: 48 additions & 0 deletions experiments/mandelbrot/Erlang-Hipe/mandelbrot.erl
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
% The Computer Language Benchmarks Game
% http://benchmarksgame.alioth.debian.org/
%% Contributed by Fredrik Svahn based on Per Gustafsson's mandelbrot program

-module(mandelbrot).
-export([main/1]).
-define(LIM_SQR, 4.0).
-define(ITER, 50).
-define(SR, -1.5).
-define(SI, -1).

main([Arg]) ->
N = list_to_integer(Arg),
io:put_chars(["P4\n", Arg, " ", Arg, "\n"]),

%% Spawn one process per row
Row = fun(Y)-> spawn(fun()-> row(0, ?SI+Y*2/N, N, 0, [], 7) end) end,
Pids = lists:map(Row, lists:seq(0,N-1)),

%Pass token around to make sure printouts are in the right order
hd(Pids) ! tl(Pids) ++ [ self() ],
receive _Token -> halt(0) end.

%Iterate over a row, collect bits, bytes and finally print the row
row(X, _, N, Bits, Bytes, BitC) when X =:= N-1 ->
receive Pids ->
put_chars(Bits, Bytes, BitC),
hd(Pids) ! tl(Pids)
end;

row(X, Y2, N, Bits, Bytes, 0) ->
row(X+1, Y2, N, 0, [Bits bsl 1 + m(?ITER, ?SR+X*2/N, Y2) | Bytes], 7);

row(X, Y2, N, Bits, Bytes, BitC) ->
row(X+1, Y2, N, Bits bsl 1 + m(?ITER, ?SR+X*2/N, Y2), Bytes, BitC-1).

%Mandelbrot algorithm
m(Iter, CR,CI) -> m(Iter - 1, CR, CI, CR, CI).

m(Iter, R, I, CR, CI) ->
case R*R+I*I > ?LIM_SQR of
false when Iter > 0 -> m(Iter-1, R*R-I*I+CR, 2*R*I+CI, CR, CI);
false -> 1;
true -> 0
end.

put_chars(_, Bytes, 7)-> io:put_chars(lists:reverse(Bytes));
put_chars(Bits, Bytes, C) -> io:put_chars(lists:reverse([Bits bsl (C+1) | Bytes])).
115 changes: 115 additions & 0 deletions experiments/mandelbrot/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
#
# This makefile should enable people to build and test all the versions of the mandelbrot
# plot for which the appropriate compilers are installed.
#
# run 'make bench' to perform the benchmark tests for the languages available on your system.
# run 'make PLOT_SIZE=nnnnn bench' to run benchmarks with a specific plotsize.
#
# Note that the tree version of the encore program might not work for small values of PLOT_SIZE.
#


PLOT_SIZE = 1600
TIME = /usr/bin/time -f 'wall-time: %E\nuser-time: %U \nsystem-time: %S\nload: %P'
ENC_TREE=mbr-tree
ENC_ROW=mbr
RACKET=Racket/mandelbrot.racket-4.racket
JAVA=java/mandelbrot.class
OCAML=OCaml/mandelbrot.ocaml_run
GCC=gcc9/gcc9
ERLANG=Erlang-Hipe/mandelbrot.beam

HAS_RACKET := $(shell racket --version 2>/dev/null)

all:
@cd Erlang-Hipe; which erlc && make; true
@cd gcc9; which erlc && make; true
@cd java; which javac && make; true
@cd OCaml; which ocamlopt && make; true
@encorec -c mbr-tree.enc
@encorec -c mbr.enc

encore-tree: mbr-tree.enc
encorec -c mbr-tree.enc

encore: mbr.enc
encorec -c mbr.enc

bench:

ifneq ("$(wildcard $(ENC_TREE))","")
@echo '--==Encore (Tree)==--'
@echo ' '
@$(TIME) ./mbr-tree $(PLOT_SIZE) > out.pbm
@echo ' '
@$(TIME) ./mbr-tree $(PLOT_SIZE) > out.pbm
@echo ' '
@$(TIME) ./mbr-tree $(PLOT_SIZE) > out.pbm
@echo ''
endif

ifneq ("$(wildcard $(ENC_ROW))","")
@echo '--==Encore (Row)==--'
@echo ' '
@$(TIME) ./mbr $(PLOT_SIZE) > out.pbm
@echo ' '
@$(TIME) ./mbr $(PLOT_SIZE) > out.pbm
@echo ' '
@$(TIME) ./mbr $(PLOT_SIZE) > out.pbm
@echo ' '
endif

ifdef HAS_RACKET
@echo '--==Racket==--'
@echo ' '
@cd Racket; $(TIME) racket mandelbrot.racket-4.racket $(PLOT_SIZE) > out.pbm
@echo ' '
@cd Racket; $(TIME) racket mandelbrot.racket-4.racket $(PLOT_SIZE) > out.pbm
@echo ' '
@cd Racket; $(TIME) racket mandelbrot.racket-4.racket $(PLOT_SIZE) > out.pbm
@echo ' '
endif

ifneq ("$(wildcard $(JAVA))","")
@echo '--==Java==--'
@echo ' '
@cd java; $(TIME) make PLOT_SIZE=$(PLOT_SIZE) run > out.pbm
@echo ' '
@cd java; $(TIME) make PLOT_SIZE=$(PLOT_SIZE) run > out.pbm
@echo ' '
@cd java; $(TIME) make PLOT_SIZE=$(PLOT_SIZE) run > out.pbm
@echo ' '
endif

ifneq ("$(wildcard $(OCAML))","")
@echo '--==OCaml==--'
@echo ' '
@cd OCaml; $(TIME) make PLOT_SIZE=$(PLOT_SIZE) run > out.pbm
@echo ' '
@cd OCaml; $(TIME) make PLOT_SIZE=$(PLOT_SIZE) run > out.pbm
@echo ' '
@cd OCaml; $(TIME) make PLOT_SIZE=$(PLOT_SIZE) run > out.pbm
@echo ' '
endif

ifneq ("$(wildcard $(GCC))","")
@echo '--==C (gcc)==--'
@echo ' '
@cd gcc9; $(TIME) make PLOT_SIZE=$(PLOT_SIZE) run > out.pbm
@echo ' '
@cd gcc9; $(TIME) make PLOT_SIZE=$(PLOT_SIZE) run > out.pbm
@echo ' '
@cd gcc9; $(TIME) make PLOT_SIZE=$(PLOT_SIZE) run > out.pbm
@echo ' '
endif

ifneq ("$(wildcard $(ERLANG))","")
@echo '--==Erlang Hipe==--'
@echo ' '
@cd Erlang-Hipe; $(TIME) make PLOT_SIZE=$(PLOT_SIZE) run > out.pbm
@echo ' '
@cd Erlang-Hipe; $(TIME) make PLOT_SIZE=$(PLOT_SIZE) run > out.pbm
@echo ' '
@cd Erlang-Hipe; $(TIME) make PLOT_SIZE=$(PLOT_SIZE) run > out.pbm
endif

6 changes: 6 additions & 0 deletions experiments/mandelbrot/OCaml/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PLOT_SIZE=1600

all:
ocamlopt -noassert -unsafe -fno-PIC -nodynlink -inline 100 unix.cmxa mandelbrot.ml -o mandelbrot.ocaml_run
run:
./mandelbrot.ocaml_run $(PLOT_SIZE)
Loading