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

Roadmap #6

Open
82 of 84 tasks
hasumikin opened this issue Mar 12, 2020 · 0 comments
Open
82 of 84 tasks

Roadmap #6

hasumikin opened this issue Mar 12, 2020 · 0 comments

Comments

@hasumikin
Copy link
Member

hasumikin commented Mar 12, 2020

mruby integration

indispensable

  • fcall w/o arg
  • fcall w/ multiple args
  • $gvar
  • @ivar
  • CONSTANT
  • recv.method
  • recv.method.chain
  • recv[]
  • +, -, *, /, %
  • (1 + 2) * 3
  • **
  • +=, -=, *=, /=, %=, &=, |=, ^=
  • **=, <<=, >>=
  • [0, 1, "Hello", :symbol] #=> Array
  • {a: 0, "key" => :value} #=> Hash
  • begin; end -> primary
  • Mass assignment #86

mruby3

  • OP_LOADI16
  • unsigned index for JMP (relative jump)

simple keywords

  • true, false, nil
  • return
  • self

particularly important on microcontroller

  • !, ~, +, -
  • not
  • &, |, ^
  • <<, >>
  • 123e-02
  • 0xffff, 0o777, 0b1111

conditional

  • if then elsif else end
  • unless then else end
  • case when else end
  • x ? y : z
  • <, >
  • ==, !=, <=, >=, ===, <=>
  • &&, ||
  • &&=, ||=
  • and, or
  • while, break, next, redo
  • until, break, next, redo
  • if modifier
  • unless modifier

syntax sugar

  • recv[]=, obj.attr=
  • recv[]+=, obj.attr+=
  • [1, 2].map(&:to_s)
  • %w[], %i[] => Array

block, lambda

  • for i in [1,2,3] #98
  • break, next, redo in block
  • [0,1].each do |var| end
  • [0,1].each { |var| }
  • a = 2; [1, 2].each{|i| a = i + a}; puts a => 5 ...OP_GETUPVAR, OP_SETUPVAR
  • ->{ }
  • yield

definition

method parameters

exception

nice to have

Improvements

should be fixed

  • b=3; 2*b+=5
  • obj.attr+=
  • overriding lvar mistakenly: a=3;p "#{b=2}#{a+b}" => "26" (should be "25"). I may have to gather lvars before making VM code
  • escape sequence in STRING ( "\n".ord => 10, p '\n' prints "\\n")
  • escape sequence in Integer notation "\33[2J"
  • 37 01 37 01 67 (double return)
  • yy_pop_なんとかで謎のSEGV
  • if a = true
    p a
    end
  • 10**-2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant