Giter VIP home page Giter VIP logo

concurnas / concurnas Goto Github PK

View Code? Open in Web Editor NEW
199.0 199.0 17.0 4.41 MB

=Please be aware that Concurnas is no longer in active development = Concurnas is an open source JVM programming language designed for building reliable, scalable, high performance concurrent, distributed and parallel systems

Home Page: https://concurnas.com

License: MIT License

TeX 6.41% C++ 4.12% Shell 0.09% Batchfile 0.07% Java 80.23% HTML 0.18% ANTLR 0.36% E 0.86% Eiffel 2.16% Augeas 0.65% C 0.01% Euphoria 4.88%

concurnas's Introduction

The Concurnas programming Language

Concurnas is an open source programming language designed for building reliable, scalable, high performance concurrent, distributed and parallel systems

Authors and major contributors

Found a bug?

  1. Check the existing issues
  2. Talk to us at Concurnas Ltd
  3. Raise an issue

Reporting Security Issues

Please do not report security issues to the public issue tracker. Please send security issues to [email protected].

Want to contribute?

Before starting to work on a feature or a fix, please open an issue to discuss the use case or bug with us. This can save both you and us a lot of time. For any non-trivial change, we'll ask you to create a short design document explaining:

  • Why is this change done? What's the use case?
  • What will the API look like? (For new features)
  • What test cases should it have? What could go wrong?
  • How will it roughly be implemented? (We'll happily provide code pointers to save you time)

This can be done directly inside the GitHub issue or (for large changes) you can share a Google Doc with us.

Contributing

We are friendly to pull requests and the team at Concurnas Ltd. will assist you in anyway we can. In order to protect yourself and other contributors to Concurnas all contributors to Concurnas must formally agree to abide by the Developer's Certificate of Origin, by signing on the bottom of the document.

To contribute:

  1. Fork the Concurnas github repository
  2. Make your changes
  3. *first time contributors: sign contributors.txt by adding your github userid, full name, email address (you can obscure your e-mail, but it must be computable by human), and date.
  4. Commit your changes
  5. Send a pull request
  6. After you have signed once, you don't have to sign future pull requests. We can merge by checking to see your name is in the contributors file.

Code Change Guidelines

All code contributions should contain the following:

  • Appropriate Unit Tests (or modifications of existing tests if they are erroneous)
  • All new and existing unit tests must pass.
  • If appropriate: Updates to the reference manual (we will republish the ebook and update the Concurnas website)

Your code needs to run on all supported Java versions (at least 1.8) and operating systems (Windows and Linux). We will verify this, but here are some pointers that will avoid surprises:

  • Be careful when using features introduced in Java 1.9 or later (modules etc), Concurnas is Java 1.8 compliant.
  • Normalize file paths in tests.
  • Watch out for Linux vs windows non incompatibilities: path separators, newline's etc.

After pull request acceptance we will manage the release process.

Building Concurnas from scratch

The build process for Concurnas is more involved than for typical projects since much of Concurnas itself is written in Concurnas! As such an iterative build is employed which bootstraps us to the point where Concurnas can compile the remaining parts of itself. Luckily for us this iterative build is managed by Gradle.

The following commands can be used in order to build Concurnas from scratch:

Windows

gradlew.bat clean build -x test   

Linux

./gradlew clean build -x test   

It is recommended that one skip the automatic running of tests unless one has a machine which is powerful enough to run them.

This will output a release zip which will look like: Concurnas-1.13.108.zip

Recommended specs for machine to run test suite

  • Min:
    • Java 1.9 for the build and testing
    • 4-core CPU
    • 16GB RAM
    • A GPU - NVIDIA GTX 590
  • Recommended:
    • Java 1.9 for the build
    • Java 1.8 and Java 1.9 - some unit tests behave differently under each version
    • 8-core CPU
    • 32GB RAM
    • A GPU - NVIDIA GTX 1060 3 GB

Developing/building via an IDE

Using an IDE to make changes to Concurnas is recommended.

Development in eclipse

The first time setup of Concurnas for eclipse is quite involved.

Plugins required:

  • ANTLR 4 IDE (0.3.6). (available in eclipse marketplace). Configured as follows:

antlrSetup

Additional plugins recommended:

  • Bytecode Outline (available in eclipse marketplace)

Generating eclipse configuration:

  1. Either:

    ./gradlew eclipse

    or import the project into eclipse as a gradle project.

  2. You may need to force the ANTLR plugin (configured as above) to detect the .g files under src\main\antlr\com\concurnas for the first time by opening them and re-saving them (this will clear up any errors about missing Visitors etc).

  3. You may also need to refresh the gradle build in order to include the ./src_derived directory as a directory containing source code for the build. (right click on build.gradle -> Gradle -> Refresh Gradle Project)

  4. Finally, you may also need to replace the JRE System Library in the project JavaBuild Path. (Java Build Path -> Libraries -> JRE System Library - Remove 1.8 and replace via the "Add Library..." button).

Generating remaining Concurnas Code:

Run the following code in eclipse (after each clean build) in order to complete the build:

  1. Generate the runtime cache:

    com.concurnas.runtimeCache.RuntimeCacheCreator
    
  2. Compile the Concurnas libraries written in Concurnas:

    com.concurnas.build.LibCompilation
    
  3. Compile the unit test helpers written in Concurnas:

    com.concurnas.concc.Concc -d ./bin/test ./tests[com/concurnas/tests/helpers]
    

Running unit tests:

It's recommended that you take the time to setup and run the unit tests within eclipse as it has good JUnit integration and you don't have to switch applications to run them interrupting your work flow. All the unit tests can be run via the following command as a JUnit test suite in eclipse:

	com.concurnas.compiler.AllTests

Specify the contents of the following file as VM arguments in order to run them correctly:

If running on Java 1.8: vmArguments-Java8.txt

If running on Java 9+: vmArguments-Java9.txt

The sandbox unit test:

The sandbox unit test is a nice way of testing Concurnas code end to end, it also provides nice profiling stats on the phases of Concurnas compilation:

  1. Edit this file: bytecodeSandbox.conc

  2. Run this unit test:

    com.concurnas.compiler.bytecode.BytecodeTestJustSandbox
    

With the aforementioned VM arguments specified contingent upon your JDK.

Msi Windows installer

Concurnas makes use of a gradle plugin in order to produce a windows .msi. This plugin stipulates the following dependencies:

Platform Requirement
all Java 8 or higher. Gradle must run with Java 8
Windows Wix Toolset or WixEdit must be installed
Linux Lintian, FakeRoot
on Ubuntu: apt-get install lintian fakeroot
Linux dpkg for creating Debian packages: apt-get install dpkg
Linux rpm for creating RPM packages: apt-get install rpm

A msi may be created with gradle as follows:

gradlew.bat clean build msi -x test   

concurnas's People

Contributors

hgarfer avatar igorperikov avatar jasontatton avatar michaeldesu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

concurnas's Issues

Implicit anonymous class name in construction

As we already give the type or it might be hinted by a method we use it in, it could be shortened to:

class AbstractClass{
    def operation(a int) int
}

instance AbstractClass = new {
    def operation(a int) => a*2
}

instance.operation(2)

With the "new" being optional.

As opposed to the current:

instance AbstractClass = new AbstractClass {
    def operation(a int) => a*2
}

As "AbstractClass" is already given as the type, the double mention of it could be optionally removed.

toString for method references

Currently method references output a toString representation as follows (when running conc in in REPL mode):

conc> plus = def(a int, b int) => a + b
plus ==> repl$$repl$$$Lambda0repl0@5e2028a3

A better toString representation would be:

conc> plus = def(a int, b int) => a + b
plus ==> (int, int) int

classloader fails on apache poi libs

compile with: concc -cp "./include/poi-ooxml-4.1.2.jar;./include/poi-4.1.2.jar" -d ./classes ./src

test.conc:

import java.io.FileOutputStream
import org.apache.poi.hssf.usermodel.HSSFCell
import org.apache.poi.hssf.usermodel.HSSFRow
import org.apache.poi.hssf.usermodel.HSSFSheet
import org.apache.poi.hssf.usermodel.HSSFWorkbook

System.out.println("starting")

workbook = new HSSFWorkbook()
sheet = workbook.createSheet("FirstExcelSheet")
row = sheet.createRow(0)
cell = row.createCell(0)
cell.setCellValue("hello")
workbook.write(new FileOutputStream("excel.xlsx"))
workbook.close()    

bug concerning classloading

Classloading related bug causing the following:

java.lang.LinkageError: loader (instance of  com/concurnas/conc/Conc$ConcClassLoader): attempted  duplicate class definition for name: "htsjdk/samtools/SamReaderFactory$Globals$"
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
import htsjdk.samtools.SamReaderFactory
def main(){
    samReaderFactory = SamReaderFactory.makeDefault()  
    System.out.println("Created SamReaderFactory")
}

You can get the jar file with:

wget https://repo1.maven.org/maven2/com/github/samtools/htsjdk/2.22.0/htsjdk-2.22.0.jar

Then compile & run like:

concc -cp htsjdk-2.22.0.jar classloaderbug.conc  && conc classloaderbug

(if you put the source into classloaderbug.conc)

Thanks for any help!

Implicit parameter types of the same type

Like Go, it would be nice to be able to use:

def func(x, y int, z str) 

Instead of the current:

def func(x int, y int, z str) 

It's possible to get mixed up by the idea of a parameter not having a specified type, which is why I'll better suggest:

def func((x, y) int, z str) 

Check all keywords can be escaped

Concurnas has a features where by keywords can be used as variable names by prefixing them with '\'. This is useful when calling api methods from JVM language libraries, the origin JVM language of which has a smaller/disjoint set of keywords compared to Concurnas, and one of those keywords 'clashes'. For example, in Java:

myObject.open()

In concurnas:

myObject.\open()

Not all keywords are currently captured by the Concurnas.g4 NAME lexical component. This needs to be updated to reflect the full set of keywords.

Cannot run hello world on Ubuntu

I have created the following file:

main.conc

System.out.println("hello world")

Compiled with:

$ bin/concc main.conc

This created main.class in the local dir. All good.

Trying to run with conc results in:

➜  Concurnas-1.14.015 bin/conc main     
java.lang.SecurityException: Prohibited package name: java.lang
	at java.base/java.lang.Throwable.init(Throwable.java:270)
	at java.base/java.lang.Exception.init(Exception.java:66)
	at java.base/java.lang.RuntimeException.init(RuntimeException.java:62)
	at java.base/java.lang.SecurityException.init(SecurityException.java:52)
	at java.base/java.lang.ClassLoader.preDefineClass(ClassLoader.java:898)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1014)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:877)
	at com.concurnas.runtime.ConcurnasClassLoader.defineClassSupportingEtc(ConcurnasClassLoader.java:268)
	at com.concurnas.runtime.ConcurnasClassLoader.defineClass(ConcurnasClassLoader.java:218)
	at com.concurnas.runtime.ConcurnasClassLoader.loadClass(ConcurnasClassLoader.java:451)
	at com.concurnas.runtime.ConcurnasClassLoader.loadClass(ConcurnasClassLoader.java:390)
	at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3172)
	at java.base/java.lang.Class.privateGetPublicMethods(Class.java:3197)
	at java.base/java.lang.Class.getMethods(Class.java:1910)
	at com.concurnas.conc.Conc.getMethod(Conc.java:324)
	at com.concurnas.conc.Conc.doMainLoop(Conc.java:253)
	at com.concurnas.conc.Conc.doit(Conc.java:180)
	at com.concurnas.conc.Conc.main(Conc.java:72)
Unknown error in conc: Failure during definition of class: java.lang.String
java.lang.RuntimeException: Failure during definition of class: java.lang.String
	at com.concurnas.runtime.ConcurnasClassLoader.defineClass(ConcurnasClassLoader.java:221)
	at com.concurnas.runtime.ConcurnasClassLoader.loadClass(ConcurnasClassLoader.java:451)
	at com.concurnas.runtime.ConcurnasClassLoader.loadClass(ConcurnasClassLoader.java:390)
	at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3172)
	at java.base/java.lang.Class.privateGetPublicMethods(Class.java:3197)
	at java.base/java.lang.Class.getMethods(Class.java:1910)
	at com.concurnas.conc.Conc.getMethod(Conc.java:324)
	at com.concurnas.conc.Conc.doMainLoop(Conc.java:253)
	at com.concurnas.conc.Conc.doit(Conc.java:180)
	at com.concurnas.conc.Conc.main(Conc.java:72)
Caused by: java.lang.SecurityException: Prohibited package name: java.lang
	at java.base/java.lang.Throwable.init(Throwable.java:270)
	at java.base/java.lang.Exception.init(Exception.java:66)
	at java.base/java.lang.RuntimeException.init(RuntimeException.java:62)
	at java.base/java.lang.SecurityException.init(SecurityException.java:52)
	at java.base/java.lang.ClassLoader.preDefineClass(ClassLoader.java:898)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1014)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:877)
	at com.concurnas.runtime.ConcurnasClassLoader.defineClassSupportingEtc(ConcurnasClassLoader.java:268)
	at com.concurnas.runtime.ConcurnasClassLoader.defineClass(ConcurnasClassLoader.java:218)
	... 10 more

Better GPU memory management

Unlike the rest of Concurnas which supports garbage collection, GPU Memory management is manual currently (sorry!). Given the performance benefits (100x speed up vs a single core algorithm and far reduced power consumption), and the fact that a typical GPU algorithm does require some advanced understanding of the GPU hardware to write in the first place, I think we can get away with leaving this for the developer to manage for now...

Some form of automatic or assisted memory management on the GPU is a fascinating topic though and it would be beneficial for Concurnas.

Compile error when declaring types

I get a compile error with this program. Why?

// This compiles
tuple Tuple3<long, String, double> = 1, "North America", 1.3
System.out.println("tuple: " + tuple)
// This does not compile. Why?
// line 6:28 mismatched input ')' expecting {':', '?', '??', '['}
tuple2 (long, String, double) = 1, "North America", 1.3

repl /vars command to output type

Currently the REPL /vars command will output a list of explicit and implicit declared variables without type information. It would be beneficial to add type information to this output.

e.g.

conc> a=10
a ==> 10

conc> 100
$0 ==> 100

conc> myString = a["hi"]
myString ==> hi

conc> /vars
$0
a
myString

Vars could output:

conc> /vars
$0        int
a         int
myString  java.lang.String[]

etc

Merge release jar's

Currently the Concurnas gradle build outputs two release jars: Concurnas-1.14.016.jar and Concurnas-rt-1.14.016.jar. There isn't really a good reason for this. It would be better to merge the two output jars into one Concurnas-1.14.016.jar.

Should be a simple change tothe gradle build script

init block unexpected behaviour

The following code results in behavior which is unexpected for some users:

public open class A(x int) {
   this() {
      x = 1
   }
   val a1 = {System.out.println("A 1"); 1}
   init {
        System.out.println("A init")
   }
   val a2 = {System.out.println("A 2"); 1}
}

public class B(y int) < A {
   val b1 = {System.out.println("B 1"); 1}
   init {
        System.out.println("B init")
   }
   val b2 = {System.out.println("B 2"); 1}
}

Results in:

conc>new B(8)
A 1
A 2
B 1
B 2
B init//no A init call

This is because in the Concurnas specification we define that for init blocks are "added to the end of any generated constructors".

This has reported as unexpected. An alternative approach is to execute init blocks at the end of any 'primary' constructors (i.e. those which don't call another this constructor), in much they same way as field initializers are called before the body of said constructor. - This approach is taken by Kotlin.

Java Swing Compatibility problems

Unable to create a JFrame under jdk 11.0.5

`
| Welcome to Concurnas 1.14.016 (Java HotSpot(TM) 64-Bit Server VM, Java 11.0.5).
| Currently running in REPL mode...
| For help type: /help

conc> new javax.swing.JFrame("Swing Paint Demo").setVisible(true)
| java.lang.ExceptionInInitializerError
| java.desktop/sun.awt.SunToolkit.checkAndSetPolicy(SunToolkit.java:374)
| at line:1
`

Likely to be a problem related to fiberization when applied to Swing.

Gradle, porting groovy to kts

Hey,

I ported the gradle.build to kts for exercise and fun here

The only thing remaining out is the sdkman plugin configuration (I couldnt find a way yet).

Is it really necessary?

Syntax highlighting for conc REPL

It should be possible to leverage the ANTLR lexer used by Concurnas to implement this functionality within the code calling jline3

Gradle Plugin

Can a Gradle plugin be developed so we can use this in with Gradle? Mostly they would be mixed projects with code already in other JVM languages.

Online try-concurnas site

In order to encourage uptake and to help people understand Concurnas it would be beneficial to offer try-it-online functionality for Concurnas code. For example, like this: https://try.kotlinlang.org/

This could be achieved either by hosting a controlled JVM which would accept scripts and execute them appropriately (server and client side) [hard], having a javascript backend for Concurnas (client side) [hard], or by interpreting bytecode with javascript in the browser [medium] (Example: DoppioJVM - https://plasma-umass.org/doppio-demo/)

Error while using conc from Command line in Windows

I have installed Concurnas using the Microsoft installer provided in the Website version 1.14.019. The installation was successful. I have added the required path variable.

I am getting the following error:

Caching runtime enviroment for Concurnas version: 1.14.019 and JVM Spec: 11.0.2. This needs to be done only once. This may take a few minutes...
Error in cache genneration: Illegal character in opaque part at index 20: jar:file:/C:/Program Files/Concurnas/rtCache/tdrzkhqu/java.base.jar
java.lang.IllegalArgumentException: Illegal character in opaque part at index 20: jar:file:/C:/Program Files/Concurnas/rtCache/tdrzkhqu/java.base.jar
        at java.base/java.net.URI.create(URI.java:883)
        at com.concurnas.runtimeCache.StaticLambdaClassesFinder.buildGraphAndGetDirectStaticLambdas(StaticLambdaClassesFinder.java:59)
        at com.concurnas.runtimeCache.StaticLambdaClassesFinder.go(StaticLambdaClassesFinder.java:113)
        at com.concurnas.runtimeCache.RuntimeCacheModules.doAug(RuntimeCacheModules.java:142)
        at com.concurnas.runtimeCache.RuntimeCache.doAgumentation(RuntimeCache.java:56)
        at com.concurnas.runtimeCache.RuntimeCacheCreator.makeCache(RuntimeCacheCreator.java:19)
        at com.concurnas.conc.ConcWrapper.performCache(ConcWrapper.java:125)
        at com.concurnas.conc.ConcWrapper.access$100(ConcWrapper.java:26)
        at com.concurnas.conc.ConcWrapper$CacheEstablisher.establishCache(ConcWrapper.java:229)
        at com.concurnas.conc.ConcWrapper$CacheEstablisher.access$500(ConcWrapper.java:137)
        at com.concurnas.conc.ConcWrapper.main(ConcWrapper.java:300)
Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 20: jar:file:/C:/Program Files/Concurnas/rtCache/tdrzkhqu/java.base.jar
        at java.base/java.net.URI$Parser.fail(URI.java:2915)
        at java.base/java.net.URI$Parser.checkChars(URI.java:3086)
        at java.base/java.net.URI$Parser.parse(URI.java:3122)
        at java.base/java.net.URI.<init>(URI.java:600)
        at java.base/java.net.URI.create(URI.java:881)
        ... 10 more
``

Add type system graph to documentation

including: primitives (and boxed equivalents + special types for gpu computing), object (+CObject), object types, refs, function types (+ method and constructor references), tuples

Top level code in addition to gpu code error

gpukernel 1 gpuTestOp(global in A float[], global in B float[], global out result float[]) 
{
    idx = get_global_id(0)
    result[idx] = A[idx] + B[idx] 
}

device = gpus.GPU().getGPUDevices()[0].devices[0]

The above code fails, with the likes of:

gpu2.conc line 7:0 non constant top level variable may not be used within a gpudef or gpukernel
gpu2.conc line 7:14 new may not be used within a gpudef or gpukernel
gpu2.conc line 7:20 cannot invoke getGPUDevices within a gpu kernel or function as it's a method and not a gpu function or gpu kernel
gpu2.conc line 7:39 cannot invoke getDevices within a gpu kernel or function as it's a method and not a gpu function or gpu kernel
gpu2.conc line 7:39 non primative types may not be used within a gpudef or gpukernel

Likely the bug is in transpilation of gpu code defined in conc files

concc to generate fat jar's

It would be good to be able to create jar's along the lines of: https://stackoverflow.com/questions/54616030/difference-between-jar-fat-jar-executable-jar

  • Skinny – Contains ONLY the bits you literally type into your code editor, and NOTHING else.
  • Thin – Contains all of the above PLUS the app’s direct dependencies of your app (db drivers, utility libraries, etc).
  • Hollow – The inverse of Thin – Contains only the bits needed to run your app but does NOT contain the app itself. Basically a pre-packaged “app server” to which you can later deploy your app, in the same style as traditional Java EE app servers, but with important differences.
  • Fat/Uber – Contains the bit you literally write yourself PLUS the direct dependencies of your app PLUS the bits needed to run your app “on its own”.

Currently the concc app creates only the Skinny variety

Improve tuple decomposition syntax

Concurnas supports tuple decomposition as follows:

mytuple = (1, 2, 3)
(v1, v2, v3) = mytuple

This also enables the likes of:

ar=[1 2 3 4 5]
(ar[1], ar[0]) = ar[0], ar[1]

The syntax would be slightly more clean if it could be provided as follows:

mytuple = (1, 2, 3)
v1, v2, v3 = mytuple

i.e. without the parentheses being necessary for tuple decomposition

Equality for tuples

Equality for tuples is not currently implemented correctly:

a = (2, 3)
b = (7, 6)
assert a <> b //this fails as a == b resolves True which is incorrect

Cannot start REPL on Ubuntu

Hi!

I wanted to try Concurnas, so I got the zip and unpacked it in a random folder, tried to run it but I get an error:

➜  bin ./conc                   
Caching runtime enviroment for Concurnas version: 1.14.015 and JVM Spec: 1.8.0_151. This needs to be done only once. This may take a few minutes...
 <*> 100% | [   2s] | Completed!
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object

I had a look at the bash script, extracted what I thought was necessary, and ended up with this:

➜  bin java -cp /home/renato/programming/programs/Concurnas-1.14.015/lib/Concurnas-1.14.015.jar:/home/renato/programming/programs/Concurnas-1.14.015/lib/Concurnas-rt-1.14.015.jar com.concurnas.conc.ConcWrapper conc

Cannot start Concurnas conc due to: system propertly: com.concurnas.home must be set. e.g. -Dcom.concurnas.home=???
java.lang.RuntimeException: system propertly: com.concurnas.home must be set. e.g. -Dcom.concurnas.home=???
	at com.concurnas.conc.ConcWrapper$CacheEstablisher.establishCache(ConcWrapper.java:146)
	at com.concurnas.conc.ConcWrapper$CacheEstablisher.access$500(ConcWrapper.java:137)
	at com.concurnas.conc.ConcWrapper.main(ConcWrapper.java:300)

Fixing the system property, it still won't work:

➜  bin java -Dcom.concurnas.home=$(pwd)/.. -cp /home/renato/programming/programs/Concurnas-1.14.015/lib/Concurnas-1.14.015.jar:/home/renato/programming/programs/Concurnas-1.14.015/lib/Concurnas-rt-1.14.015.jar com.concurnas.conc.ConcWrapper conc
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object

I can run my java apps just fine normally :) no idea why this is occurring...

Minor typo and a discrepancy in documentation

  1. https://concurnas.com/docs/gpuParallelProgramming.html#events has a typo in line
    copyComplete boolean:gps.GPURef = intoGPU1.writeToBuffer([1 2 3 4 5 6 7 8 9 10]) whereas it should refer to type gpus.GPURef
  2. attempting to run got = inoutGPU.readFromBuffer() in REPL results in error | ERROR 1:6 in got - inoutGPU cannot be resolved to a variable; but changing variable reference to intoGPU1 still errors out | ERROR 1:15 in got - The method readFromBuffer is not visible

Built-in println command

Concurnas is a new language- so a chance to introduce its own 'println' command. Let's get rid of System.out.println forever!

Code completion for conc REPL

Jline3 has good support for code completion. We can leverage this to support code completion for Concurnas code in the cocn REPL.

The most value would likely be derived by implementing this functionality in the following order:

  1. dot completion
  2. variable name completion
  3. keyword completion

Build issue with Java 8

Currently I am not able to build Concurnas using Java 8, I have tested the following Java implementations (presented with their sdkman names):

8.0.242-amzn
8.0.242-open
8.0.242.j9-adpt

it does build using 9.0.4-open,

Stacktrace:

> Configure project :
Gradle version: 5.6.1

> Task :clean
> Task :generateGrammarSource

> Task :compileJava
/home/holger/projects/concurnas/Concurnas/src/runtimeCache/com/concurnas/runtimeCache/RuntimeCacheModules.java:119: error: cannot find symbol
	private static Path modStrToURI(Module mod) {
	                                ^
  symbol:   class Module
  location: class RuntimeCacheModules
/home/holger/projects/concurnas/Concurnas/src/runtime/com/concurnas/runtime/bootstrapCloner/Cloner.java:41: warning: Unsafe is internal proprietary API and may be removed in a future release
import sun.misc.Unsafe;
               ^
/home/holger/projects/concurnas/Concurnas/src/runtimeCache/com/concurnas/runtimeCache/RuntimeCacheModules.java:133: error: cannot find symbol
		List<Path> modulePaths = ModuleLayer.boot().modules().stream().map(a-> modStrToURI(a) ).sorted().collect(Collectors.toList());
		                         ^
  symbol:   variable ModuleLayer
  location: class RuntimeCacheModules
/home/holger/projects/concurnas/Concurnas/src/runtime/com/concurnas/runtime/bootstrapCloner/Cloner.java:218: warning: Unsafe is internal proprietary API and may be removed in a future release
	private static Unsafe unsafe;
	               ^
/home/holger/projects/concurnas/Concurnas/src/runtime/com/concurnas/runtime/bootstrapCloner/Cloner.java:221: warning: Unsafe is internal proprietary API and may be removed in a future release
			Field f = Unsafe.class.getDeclaredField("theUnsafe");
			          ^
/home/holger/projects/concurnas/Concurnas/src/runtime/com/concurnas/runtime/bootstrapCloner/Cloner.java:223: warning: Unsafe is internal proprietary API and may be removed in a future release
	        unsafe = (Unsafe) f.get(null);
	                  ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
4 warnings

> Task :compileJava FAILED
> Task :processResources NO-SOURCE

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.6.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 4s
3 actionable tasks: 3 executed

It seems java.lang.Module has been introduced in Java 9 which explains the error.

Should it be pointing to a different Module class?

Happy to help with this error but I am afraid I will need a bit of guidance.

highlight.js support

Seems to be a very popular hs highlighting lib. Note Concurnas support has already been added to prism.js

Correction error in example Concurnas vs Java - Part 1

Just a minor correction, 👍
I am on Windows 10 64 bit , Concurnas 1.14.020

The following example:

class CounterHolder(public -n int)

counter = CounterHolder(10)

countDownStr := {
ret = StringBuilder()
while(counter.n-- > 0){//we are changing the value of n
ret.append(n)
}
ret.toString()//return a String
}!

System.out.println("countdown from: {counter.n} == {countDownStr}")
//outputs: countdown from: 10 == 9876543210:

gives a compilation error:

line 8:19 n cannot be resolved to a variable
line 8 is the line: while(counter.n-- > 0) ...

However, the error occurs in the following line: ret.append(n)
where n is not recognized.

Changing the code to:

n = counter.n
while(n-- > 0){//we are changing the value of n
    ret.append(n)
}

solves the problem.

Better immutability algorithm

Currently, Concurnas implements a relatively primitive (but conservative and correct) mechanism for determining if a 'normal', non ref, non actor object is immutable for the purposes of copying across isolates. This algorithm could benefit from being improved

Warn when Concurnas code executed outside of Concurnas

The Concurnas compiled creates valid Java bytecode which can be executed in any JVM (version 1.8 and above).

This is a problem in cases where people attempt to execute concurnas code via say Java since it will not function correctly (e.g. isolates and actors will not correctly run).

A way to fix this is to warn users when they run Concurnas code outside of conc.

Tuple decomposition assignment to object fields via implicit setter

Tuple decomposition assignment to object fields fails when assignment must be performed via implicit setter method:

conc> class Thing(~a int, ~b int, public c int, public d int)
conc> t = Thing(1, 2, 3, 4);
conc> (t.c, t.d) = 20, 30
conc> (t.a, t.b) = 20, 30
|  ERROR 1:1 The left-hand side of an assignment must be a variable

The final line should be valid code and be directed to assign via the implicitly generated setter methods of class Thing

java.lang.VerifyError: Bad type on operand stack with com/sun/net/httpserver/spi/HttpServerProvider

The following code with jdk 11 on windows compiles ok but fails with a java.lang.VerifyError

from com.sun.net.httpserver import HttpServer, HttpContext, HttpExchange, HttpHandler
import java.io.OutputStream
import java.net.InetSocketAddress
 
class MyHandler with HttpHandler {
  def handle(exchange HttpExchange) void {
    val response = "Hi There!"
    exchange.sendResponseHeaders(200, response.getBytes().length)
    val os = exchange.getResponseBody()
    os.write(response.getBytes())
    os.close()
  }
}
 
def main() void {
  val server = HttpServer.create(new InetSocketAddress("localhost", 8500), 0)
  server.createContext("/", new MyHandler())
  server.start()
}

upon runtime this throws a java.lang.VerifyError:

java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    com/sun/net/httpserver/spi/HttpServerProvider.<clinit>()V @7: putstatic
  Reason:
    Type uninitialized 0 (current frame, stack[0]) is not assignable to 'java/lang/Object'
  Current Frame:
    bci: @7
    flags: { }
    locals: { }
    stack: { uninitialized 0 }
  Bytecode:
    0000000: bb00 da59 0157 57b3 00df 01b3 0091 b1
        at jdk.httpserver/com.sun.net.httpserver.HttpServer.create(HttpServer.java:136)
        at http$Globals$.main(http.conc:16)
        at $ConcEXE.apply($ConcEXE.java)
        at $ConcEXE.apply($ConcEXE.java)
        at java.base/com.concurnas.bootstrap.runtime.cps.IsoCore._runExecute(IsoCore.java:25)
        at java.base/com.concurnas.bootstrap.runtime.cps.Iso.execute(Iso.java:48)
        at java.base/com.concurnas.bootstrap.runtime.cps.Worker.run(Worker.java:56)

Likely to be a problem relating to fiberization of the HttpServerProvider clinit method

Running a series of GPU examples in REPL causes OOM

  1. JDK used: Graal VM / OpenJDK 11.0.7 on Windows 10
  2. starting conc -J-Xmx2g

...>conc -J-Xmx2g
[Use -Dgraal.LogFile= to redirect Graal log output to a file.]
Cannot install GraalVM MBean due to Cannot find method registerNativeMethods due to java.lang.InternalError:java.lang.IllegalAccessException: class com.concurnas.bootstrap.runtime.cps.ReflectionHelper (in module java.base) cannot access class jdk.vm.ci.hotspot.HotSpotJVMCIRuntime (in module jdk.internal.vm.ci) because module jdk.internal.vm.ci does not export jdk.vm.ci.hotspot to module java.base.
Welcome to Concurnas 1.14.020 (OpenJDK 64-Bit Server VM, Java 11.0.7).

  1. Running GPU examples from https://concurnas.com/docs/gpuParallelProgramming.html
  2. After executing
gps = gpus.GPU()
deviceGrp = gps.getGPUDevices()[0]
summary = deviceGrp getSummary()
device = deviceGrp.devices[0]
inoutGPU = device.makeOffHeapArrayMixed<int[]>(int[].class, 10)
copyComplete boolean:gpus.GPURef = inoutGPU.writeToBuffer([1 2 3 4 5 6 7 8 9 10])
await(copyComplete)

observe runaway heap consumption in VisualVM, which ends up with exception trace

java.lang.OutOfMemoryError: Java heap space
at java.base/java.util.HashMap.resize(HashMap.java:699)
at java.base/java.util.HashMap.putVal(HashMap.java:624)
at java.base/java.util.HashMap.put(HashMap.java:607)
at org.antlr.v4.runtime.atn.PredictionContext.combineCommonParents(PredictionContext.java:476)
at org.antlr.v4.runtime.atn.PredictionContext.mergeArrays(PredictionContext.java:459)
at org.antlr.v4.runtime.atn.PredictionContext.merge(PredictionContext.java:174)
at org.antlr.v4.runtime.atn.PredictionContext.mergeSingletons(PredictionContext.java:225)
at org.antlr.v4.runtime.atn.PredictionContext.merge(PredictionContext.java:155)
at org.antlr.v4.runtime.atn.PredictionContext.mergeSingletons(PredictionContext.java:225)
at org.antlr.v4.runtime.atn.PredictionContext.merge(PredictionContext.java:155)
...

and after a while, REPL terminates as well due to OOM

Allow conc command to pass through JVM args

Allow the conc command to pass through arguments to the underlying JVM instance upon which it's run. E.g. garbage collector properties etc

The concc command may also benefit from this functionality.

use TABLESWITCH and LOOKUPSWITCH in match statements

Under the hood, the bytecode of the match statement currently expands all definitions to a if-elif-else block. This is usually ok but we're missing a trick when the match statement itself is eqivilent to a Java switch statement:

Unlike if-then and if-then-else statements, the switch statement can have a number of possible execution paths. A switch works with the byte, short, char, and int primitive data types. It also works with enumerated types (discussed in Enum Types), the String class, and a few special classes that wrap certain primitive types: Character, Byte, Short, and Integer (discussed in Numbers and Strings).
-From the Javadocs

The java switch statement is compiled to a TABLESWITCH or LOOKUPSWITCH. Details of the difference between the two are here: https://stackoverflow.com/questions/10287700/difference-between-jvms-lookupswitch-and-tableswitch

It would be beneficial for Concurnas to do this as well for the approperiate cases where the conditions are met.

Implementation should most be doable within the BytecodeGennerator class (final step of iterative code genneration of the Concurnas compiler).

"Insatiable" Traits

Hi.

I just stumbled upon this new language and was going over the docs.
I found this funny typo in the opening paragraph for Traits https://concurnas.com/docs/traits.html

Traits allow us to define elements of reusable functionality (both methods and state) which can be mixed-in to classes. They are themselves not insatiable as, like abstract classes [...]

I have an insatiable appetite for new languages... maybe I'll take a look a Concurnas in the future.

Better multi-type checking support

@DeflatedPickle at 21:50
@jasontatton, in Kotlin, for type checking, it's annoying to do:
thing is Clazz && thing is Interface && thing is OtherInteface

Or:
thing is Clazz || thing is Interface || thing is OtherInteface

I think it would be nice syntactic sugar to have:
thing isall [Class, Interface, OtherInterface]

And:
thing isany [Class, Interface, OtherInterface]

What are the perks?

  • Shorter
  • The list can be passed by a user and used elsewhere

What are the downsides?

  • New keywords
  • Probably already a different solution
  • Could be done by testing the class

classpath imports seem not to work for the REPL

$ conc -cp "joda-time-2.9.4.jar"
Welcome to Concurnas 1.14.020 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_251).
Currently running in REPL mode. For help type: /help

conc> import org.joda.time.DateTime
|  ERROR 1:0 Imported name: org.joda.time.DateTime cannot be resolved to a type

conc> from org.joda.time import DateTime
|  ERROR 1:0 Imported name: org.joda.time.DateTime cannot be resolved to a type

conc>

The above really should work

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.