Giter VIP home page Giter VIP logo

adept's People

Contributors

apis035 avatar isaacshelton avatar seekingmeaning avatar ttury 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

adept's Issues

[add] More types support for libc libs.

@IsaacShelton

code:

import basics
import "sys/cmath.adept"

func main(argc int, argv **ubyte)
{
        print(sin(30))
}

error:

file.adept:6:11: Undeclared function sin(int)!
6|    print(sin(30))
            ^^^

Potential Candidates:
    sin(double) double

Embedding

The ability to embed Adept would be nice in the future, when it's in a more usable state.

[bug] Link failed.

@IsaacShelton

Undefined symbols for architecture x86_64:
  "_repl_execute", referenced from:
      _compiler_repl in compiler.o
  "_repl_free", referenced from:
      _compiler_repl in compiler.o
  "_repl_helper_sanitize", referenced from:
      _compiler_repl in compiler.o
  "_repl_init", referenced from:
      _compiler_repl in compiler.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [bin/adept] Error 1

[add] New options: -I, -L, -l

@IsaacShelton I think it will be better if there will be -I for import directory, -l for linking Adept .a files to Adept and -L for library directory of Adept .a files.

Question: Does Adept supports linking C libraries like libreadline.1.a and others libraries for C?

Few questions.

@IsaacShelton

  1. When you'll release documentation for Adept? (I really want to learn Adept.)

  2. Is there any way to read command-line arguments like in C?

int main(int argc, char *argv[]) { ... }

[idea] Documentation in Markdown (not in PDF)

@IsaacShelton

I think that if you want to write documentation for Adept, you can do this in Markdown style in docs/*.md or GitHub wiki (not in PDF, like for Adept 2.3). What do you think about that?

NOTE: I think that documentation in Markdown is better that PDF documentation because of text styling.

[idea] namespaces

@IsaacShelton

namespace example_namespace {
    func msg(text String) {
        print(text)
    }
}

func main()
{
    example_namespace::msg("Hello, world!")
}

or:

namespace example_namespace {
    func msg(text String) {
        print(text)
    }
}

using namespace example_namespace

func main()
{
    msg("Hello, world!")
}

[bug] using FFI in namespaces

@IsaacShelton

code:

namespace io {
        foreign printf(in *ubyte, in ...) int
}

func main() {
        io\printf('Hello, world!\n')
}

result:

Undefined symbols for architecture x86_64:
  "_io\printf", referenced from:
      _main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
EXTERNAL ERROR: link command failed
gcc "main.o" -o "main"

[add] Move warnings detection to compiler.

@IsaacShelton

code:

import basics

func main(argc int, argv **ubyte)
{
        printf("%s", 5) // should call a warning
}

compilation:

Compiler does not says anything about this warning.

$ ./adept file.adept
... returns nothing
$

execution:

Only on the execution step.

$ ./file
WARNING: vsprintf(*String, String, VariadicArray) expected *ubyte value for %s, got 'int' instead
zsh: segmentation fault  ./file

[add] Better array literals

I don't have a full idea yet of how to implement this, but the goal is to have the following:

arr *int = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
arr 10 int = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
arr <int> Array = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
arr <int> List = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}

I'm thinking this will probably require some built-in type kind of like std::initializer_list in C++.

[add/bug] Allow inc/dec float and uint bug.

@IsaacShelton

I found information about decrementing unsigned int 0:

In C:

unsigned int i = 0;
i--;
printf("%d", i); // -1
printf("%u", i); // 4294967295

NOTE: Unsigned integers have well-defined behaviour for all arithmetic operations; specifically, they implement "artithmetic modulo 2^N", where N is the number of value bits in the type. So -1 is in fact 2^N − 1

In Adept:

i uint = 0
i--
print(i)

Returns 4294967295

Big problem with new experimental syntax (`:` problems, polymorphs can't be declared).

@IsaacShelton I have changed this syntax to be used as default and I detected that you made : work not only for declaring variables. I mean that if make : default, then you should use : every time you type data type:

num : int = 0
printf(num as : int) // must be num as int

If not, it won't compile (if it will be default syntax)

P.S. I think this happens because you added : to the parse_type() and now every time you want to write type you should write : before it.

Also after this syntax, I can't correctly write this string (I do not know where I should put :):

struct <$T> PolymorphicStructName (field1 $T, field2 <$T> AnotherType)

This not works:

<$T> PolymorphicStructName :: struct(field1 : $T, field2 : <$T> AnotherType)

[idea] Assembler integrations

@IsaacShelton I know I was already opening this issue, I just thought that if you have some free time, it would be cool if this was added.

main :: func() : int {
    asm {
        "mov eax, ebx",
        "push eax"
    }
    return 0
}

P.S. I think interactions with a low-level language such as assembler are useful for deep development.

[idea] idea for output binary filename.

@IsaacShelton

I have an idea that you might not like, but I would like to add it. The point is that the compiler creates a binnary file with the same name as the source file itself, but if the user wants to change this (without using the -o option), you can add a special meta directive at the beginning of source file (excluding libraries)

main.adept:

#program hello

#import <basics>

func main() {
    print("hello")
}

adept main.adept # will output binary with hello filename

If you don't want to add it (in fact, it's really a useless function), then tell me how to add it, I would like to create a custom Adept version for myself with this option.

`#define` problems

@IsaacShelton

code:

import basics

#define SAS //define sas

func main()
{
        #if SAS
                #error "sas" // should show error
        #end
        printf("Hello, world!\n")
}

result:

successful compilation without errors

Update warnings.

@IsaacShelton

I think that warnings should display fragment of code like errors.

Also updating #warning for showing line:char and fragment of code like #error.

[improve] Improve support for function aliases

[improve] Allow for variadic and varargs (without indirectly forcing it)

func alias echo(..) => print
func alias strictPrintf(*ubyte, ...) => printf

[bug] Also this should compile, but doesn't:

import basics

func print(a int){
    a = 10
}

func alias echo() => newline
func alias echo(String) => print
func alias echo(int) => print

func main {
    echo("Hello World")
    echo()
    echo("This is a test")
    echo(12345)
}

func echo(value int){
    print(toString(value).reversed())
}

It should prefer the function named echo over the function alias, but it fails to compile.

[improve] namespaces

  • Add namespace my_namespace { } / my_namespace :: namespace { }
  • Add using namespace my_namespace
namespace my_namespace {
    func my_function() { }
}

func main {
    my_namespace\my_function() // after using namespace, just my_function()
}

And for new-style syntax:

my_namespace :: namespace {
    my_function :: func() { }
}

main :: func {
    my_namespace\my_function() // after using namespace, just my_function()
}

NOTE: For details see #36

[constant bug] Const not working.

@IsaacShelton

I have updated AdeptImport and changed all old-style declarations to new and got undeclared variable errors.

If change old-style const to new style const in libraries, then it will not work:

EOF == (-1)

changed to

const EOF = (-1)

and got this error:

cstdio.adept:147:30: Undeclared variable 'EOF'!
147|        if c == 0x0A || c == EOF, break
                                 ^^^

I do not know why it works like this, maybe you can explain me why this happens.

[add] Allow printing all data types

@IsaacShelton

I have a lot of issues about printing some types such as **ubyte.

I just trying to print argv and got the following error:

code:

import basics
import "sys/cmath.adept"

func main(argc int, argv **ubyte)
{
        print(argc, argv)
}

errors:

file.adept:6:5: Undeclared function print(int, **ubyte)!
6|    print(argc, argv)
      ^^^^^

Potential Candidates:
    print(String) void
    print($T~__number__) void

I know this is a lot of work, but also I think it will be better if you allow printing all data types.

[unimplemented] Allow for variadic methods when using new variadic argument scheme


import VariadicArray
import 'sys/cstdio.adept'

struct Dummy ()

func main {
    dummy Dummy
    printf('sum = %d\n', dummy.sumEmUp(1, 2, 3, 4, 5))
}

func sumEmUp(this *Dummy, integers ...) int {
    printf('%p\n', integers.items)
    printf('%p\n', integers.next)
    printf('%d\n', integers.length as int)
    printf('%d\n', integers.index as int)
    printf('%p\n', integers.types)
    
    sum int = 0
    while integers.hasNext() {
        if integers.types[integers.index] != typeinfo int {
            printf('ERROR: sumEmUp() got non-int value!\n')
            return 0
        }

        x int = integers.readInt()
        printf('Got value: %d\n', x)
        sum += x
    }
    return sum
}

Arguments are not being packaged into a VariadicArray before being passed

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.