GithubHelp home page GithubHelp logo

shiika's People

Contributors

ai-mozi avatar aisk avatar dependabot[bot] avatar erueri avatar krout0n avatar nishidayuya avatar rui-code avatar tatupesonen avatar yamakoud avatar yhara avatar yujideveloper 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

shiika's Issues

!= is broken

eg. this does not work

if 1 != 2
  puts "ok"
end

Int#to_s

With Int#to_s and String#+, we can write this.

size = 600
puts "P4"
puts size.to_s + " " + size.to_s

Split CodeGen

code_gen/mod.rs is expected to get longer and longer.

Now it is a good time to extract gen_methods into another file.

Inherit ivars

eg.

class Base
  def initialize
    @a = 1
  end
end
class Sub : Base
  def foo -> Int
    @a
  end
end

Split @main

Current @main contains both system code and user program. Extract the latter as a function for better readability of .ll.

Error: No such file or directory

cargo run -- run examples/hello.sk
Error: Os { code: 2, kind: NotFound, message: "No such file or directory" }

full path not working too.

list files:
hello.sk
hello.sk.ll
hello.sk.opt.ll

  1. cp shiika hello.sk /tmp && cd /tmp && ./shiika hello.sk # not working too

Add void literal

At first I'm planning to use Void as void literal. However I found this conflicts of Void class object.

How about adding void pseudo variable like true and false?

Refer ivar in initialize

Found that this raises error.

class Base
  def initialize(i: Int)
    @a = i
    putd @a  #=> "ivar `@a\' was not found"
  end
end

Handle semicolon properly

Currently Lexer does not distinguish ; from newline, but there is a case where newline is allowed but semicolon is not.

Example:

# OK
foo(1,
2)
# NG
foo(1,;2)

error[E0583]: file not found for module `float`

v 0.2.5 (09b0cf5)

error[E0583]: file not found for module `float`
--> src/corelib/mod.rs:2:1
|
2 | mod float;
| ^^^^^^^^^^
|
= help: to create the module `float`, create file "src/corelib/float.rs"

error[E0583]: file not found for module `int`
--> src/corelib/mod.rs:3:1
|
3 | mod int;
| ^^^^^^^^
|
= help: to create the module `int`, create file "src/corelib/int.rs"

error[E0425]: cannot find function `create_methods` in module `float`
--> src/corelib/mod.rs:44:27
|
44 |         ("Float" , float::create_methods() , vec![]                      , HashMap::new()),
|                           ^^^^^^^^^^^^^^ not found in `float`
|
help: possible candidates are found in other modules, you can import them into scope
|
11 | use crate::corelib::bool::create_methods;
|
11 | use crate::corelib::never::create_methods;
|
11 | use crate::corelib::object::create_methods;
|
11 | use crate::corelib::shiika_internal_ptr::create_methods;
|
and 2 other candidates

error[E0425]: cannot find function `create_methods` in module `int`
--> src/corelib/mod.rs:45:25
|
45 |         ("Int"   , int::create_methods()   , vec![]                      , HashMap::new()),
|                         ^^^^^^^^^^^^^^ not found in `int`
|
help: possible candidates are found in other modules, you can import them into scope
|
11 | use crate::corelib::bool::create_methods;
|
11 | use crate::corelib::never::create_methods;
|
11 | use crate::corelib::object::create_methods;
|
11 | use crate::corelib::shiika_internal_ptr::create_methods;
|
and 2 other candidates

error: aborting due to 4 previous errors

Some errors have detailed explanations: E0425, E0583.
For more information about an error, try `rustc --explain E0425`.
error: could not compile `shiika`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

Float#% does not work

eg. 3.0 % 2 results in

Error: Error { msg: "method MethodFirstname("%") not found on ClassFullname("Float")", backtrace: 0: backtrace::backtrace::libunwind::trace

Inherit constants

eg.

class Base
  A = 1
end
class Sub : Base
  def foo
    puts A  #=> 1
  end
end

impl. Array#first

Successor of #84

  • #104 [1,2] should be inferred as Array<Int>
  • #108 Fix codegen for [1,2]
    • Array<Int>.new should be exist we can just call Array<T>.new instead.
  • #109 Extend SkClass to have (0 or more) type parameters
  • #109 Support type parameter on class definition
  • #112 Support type parameter on method return value
  • #112 impl. Array#first
  • #116 [1].first should be inferred as Int

Array literal

Long way to go...

Especially, code gen of Float/Int/Bool needs to be reconsidered to support Array<Object>.

  • #85 parser
  • #85 generic type
  • #91 change Float to llvm struct
  • #92 embed Int into pointer or make it llvm struct
  • #95 embed Bool into pointer or make it llvm struct
  • #97 codegen for array literal ([Object.new])
  • #100 codegen for non-Object item ([1,2,3])
    • cast is needed (Int -> Object)

impl. `unless`

Note: Shiika will not support unless-else (in contrast to Ruby).

Use Into for &str vs. String

I heard there's a technique to accept both &str and String as an argument. With this we can avoid unneeded .to_string()s.

Fix line number report

Since #23, the line number in error report includes corelib ๐Ÿ˜ญ

42: _main (0x1037c2bc1), details: ParseError { location: Cursor { line: 66, col: 7, pos: 1750 } } }

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.