Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
Abdulazeez Abdulazeez Adeshina
@Youngestdev
Well, the @ can stay. It'd be useful in large programs. The display keyword should be used in smaller programs
Busari Habib
@Bahat159
I mean different ways of writing their programs
Adewale Azeez
@Thecarisma

@Youngestdev for both large and small programs the Console is the better alternative, check my recent update the examples no more uses display and @ instead they uses the stdout, stderr and stdin from the Console module. This will ensure more security and more advance way of printing and reading from standard stream. the following are being alternated

stdout.print() #instead of display
stdout.println() #instead of `@`

The displaycan be spared for use for quick debug and short samples like the native hello world. the std streams in console are very efficient as they also resolve escape characters and the printf() which works like the native C printf is under development

Prince E. Darlington
@iamcoderisk
hello guys?
Azeez, you have done well, but i was thinking of having stdout imported for reusability sake; thereby enhancing the gradual usage of print() and println()
Tochukwu Nkemdilim
@TNkemdilim
I second @iamcoderisk
Prince E. Darlington
@iamcoderisk
i could send a PR on this if we agree
Adewale Azeez
@Thecarisma
@iamcoderisk imported in what way, stdout is in the Console module which will have to be imported before using stdout, stderr and stdin, please elaborate
Adewale Azeez
@Thecarisma

@/all I am adding compilation to object code to simple-lang to get ride of the module and make the entire source into one file of bytes codes like javac. The compiled source will be independent of the modules, such that when the compiled version is taken to another computer which does not have the modules it will execute. The advantages are below :

  1. Compile the source to one object file
  2. The compiled version is independent of the modules but still dependent of the dynamic modules
  3. It can be easily embeded in wrapper applications
  4. Very useful for creating polymorphic code
  5. It make the simple source secure as it not human readable
  6. Speed upexecution time as the scanner, parser, analysing are skipped, just read compiled file the run bytecode in VM

Disadvantage

  1. It not human readable and cannot be manually edited (likely an advantage)

to compile to object code after implementation

$ simple --simplify simple.sim

It generate a corresponding object file in the same folder

It not a compilation to machine code like C/C++, it compile to bytecode simple-lang vm can understand just like what java does by compiling to a bytecode file javac that can be executed on all the java distro.
Another advantage is that since simple-lang resolve called file during parsing time, it compilation is complete on a system it will give not import issues on whichever platfor it executed
Adewale Azeez
@Thecarisma
I currently adopt .complex as the file extension for the compile source as it opposite to simple and is not human readable
I need your inputs.
Adewale Azeez
@Thecarisma
A new PR requesting reviewers simple-lang/simple#59
appcypher
@appcypher
ping. What's up fellas?
Adewale Azeez
@Thecarisma
Heyo, alot of upgrade and update has been going on
You can check the major push here simple-lang/simple#59
@appcypher It ll be great to have you review the MAC OS build since it the only PR that has been stalled for months
appcypher
@appcypher
I'm assuming that PR is going to be stale by now which means more work.
What I should probably have done before is to fix the modules that can work and leave the more complicated modules like the GUI module for the future.
Tackling the behemoth as a whole was a bad idea.
Adewale Azeez
@Thecarisma
Yes the PR is stall, great idea you can fix other modules and leave out the GUI dynamic module for now
appcypher
@appcypher
Is simplelang grammar documented somewhere?
Adewale Azeez
@Thecarisma
The old grammar is currently outdated, I making a new grammar and testing it against ALTR 4 for compatibility with EBNF
appcypher
@appcypher
Sweet. I will like to see it when it is done
Adewale Azeez
@Thecarisma
@/all the new grammar is available here https://simple-lang.sourceforge.io/simple.g4.txt
Sonkeng Maldini
@sdmg15
What's the purpose of that ? :thinking_face:
Adewale Azeez
@Thecarisma
It used to understand how the source code (.sim) is treated at scanning and parsing level, i.e the structure of the language
Adewale Azeez
@Thecarisma

e.g the rule

...
assignment
    : Identifier assignmentOperator ( Identifier | Number | String | List | invokeBlock )
    | Identifier assignmentOperator classInit
    | Identifier assignmentOperator propertyStmt
    ;
...
Identifier
    : [a-zA-Z_] [a-zA-Z_0-9]*
    ;
...
assignmentOperator
    : '=' | '+=' | '-=' | '*=' | '/=' | '%=' | '<<=' | '>>=' | '&=' | '|=' | '^='
    ;

The 'assignment' rule is how simple-lang parse assignment statement
e.g

 Identifier assignmentOperator ( Identifier | Number | String | List | invokeBlock )
=
Identifier = A valid identifier 
assignmentOperator = one of the assignment operator in the above rules
(Identifier = as abover)
(Number = a valid integer)
(String = A valid string)
(List = a list item)
(invokeBlock = calling a block)

With the above that means this is valid
Name = "Sokeng" because (Name is an Identifier, = is an assignmentOperator, "Sokeng" is a string) which satisfy the rule
Identifier assignmentOperator ( Identifier | Number | String | List | invokeBlock )

So this is invalid
Name = *+# because this satisfies the rule Identifier assignmentOperator arithmethicOperator* and it not part of the assignment rule
I ll prepare a blog for more elaboration on it, also it antlr grammar you can simply look up antl grammar on google for more info
appcypher
@appcypher
Nice!
Adewale Azeez
@Thecarisma
@/all the final commit to be packed for March one has been push please kindly test if you ve got the time
@appcypher please provide a mac distro with just the simple and simple.dylib for now, minus the modules
Adewale Azeez
@Thecarisma
Documentation for the simple-lang has begin, all modules should be thorougly commented, the current doc is at https://github.com/simple-lang/simple-docs
Adewale Azeez
@Thecarisma

change the constructor implementation in this Commit simple-lang/simple@aa11a35

Before the commit the constructor behave like this. The class constructor has to be the name of the class, the draw back which is the super class constructor will not be called if the class does not have it own constructor. e.g

c = new Class() #error constructor not found

class Super
   block Super()

class Child

After the commit, constructor are simply class method with the name init in this manner if a constructor is not implemented in a class, before throwing a constructor not found exception all the super class will be queried and the first init will be the constructor

c = new Class() #display hello

class Super
   block init()
     display "Hello"

class Child
appcypher
@appcypher
Hola. I'm back! Been very busy. I apologize for disappearing like that.
I want to get my PR cleared. But that PR is so old now that I don't know if something needs to be done to get it working again.
I want to try and do something this weekend cos next week is tight for me.
How are you doing though Azeez?
appcypher
@appcypher
Where do you suggest I start from?
Adewale Azeez
@Thecarisma
Welcome back @appcypher fortunately the PR is no more needed as @iamcoderisk has provided a working mac build script which has all the modules all working
Adewale Azeez
@Thecarisma

Since you are a compiler enthusiast and I can see your works on the Web Assembly platform, I have been considering compiling to web assembly but my hand is currently full, simple currently compiles to .complex which contains the bytecodes for the program, from the bytecodes it easier to compile to assembly or transpile to other language, I ll describe the structure of the bytecode in some post later.

Another place to jump in is Documentation, publication such as wikipedia, rosetta code but the very best is more tutorial to put simple-lang on the web, recent search on google has been bringing simple-lang up to the top of the page for keywords containing simple programming

Also the modules requires implementation but I can handle that for now.
appcypher
@appcypher

Welcome back @appcypher fortunately the PR is no more needed as @iamcoderisk has provided a working mac build script which has all the modules all working

Oh sweet. I guess the PR can be closed now

@Thecarisma Cool. It would be nice to have a documentation of simple's bytecodes for the hackers
Adewale Azeez
@Thecarisma
I ll be juggling the keywords tonight for a more readable code.
call changes to from
invoke changes to call
from "external.sim" import expo

sum = block (int a, int b) {
    return a + b
}
call sum(64, 36)