rucc 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +55 -0
- data/.rspec +1 -0
- data/.travis.yml +5 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +46 -0
- data/LICENCE +21 -0
- data/README.md +82 -0
- data/Rakefile +2 -0
- data/Vagrantfile +10 -0
- data/bin/console +10 -0
- data/bin/rspec +2 -0
- data/bin/setup +8 -0
- data/exe/rucc +7 -0
- data/include/8cc.h +48 -0
- data/include/float.h +44 -0
- data/include/iso646.h +20 -0
- data/include/rucc.h +2 -0
- data/include/stdalign.h +11 -0
- data/include/stdarg.h +52 -0
- data/include/stdbool.h +11 -0
- data/include/stddef.h +15 -0
- data/include/stdnoreturn.h +8 -0
- data/lib/rucc.rb +8 -0
- data/lib/rucc/case.rb +22 -0
- data/lib/rucc/decl.rb +9 -0
- data/lib/rucc/enc.rb +9 -0
- data/lib/rucc/engine.rb +138 -0
- data/lib/rucc/file_io.rb +108 -0
- data/lib/rucc/file_io_list.rb +56 -0
- data/lib/rucc/gen.rb +1602 -0
- data/lib/rucc/int_evaluator.rb +114 -0
- data/lib/rucc/k.rb +73 -0
- data/lib/rucc/keyword.rb +17 -0
- data/lib/rucc/kind.rb +43 -0
- data/lib/rucc/label_gen.rb +13 -0
- data/lib/rucc/lexer.rb +40 -0
- data/lib/rucc/lexer/impl.rb +683 -0
- data/lib/rucc/lexer/preprocessor.rb +888 -0
- data/lib/rucc/lexer/preprocessor/cond_incl.rb +27 -0
- data/lib/rucc/lexer/preprocessor/constructor.rb +54 -0
- data/lib/rucc/lexer/preprocessor/pragma.rb +31 -0
- data/lib/rucc/lexer/preprocessor/special_macro.rb +110 -0
- data/lib/rucc/libc.rb +47 -0
- data/lib/rucc/m.rb +7 -0
- data/lib/rucc/macro.rb +24 -0
- data/lib/rucc/node.rb +530 -0
- data/lib/rucc/node/conv.rb +33 -0
- data/lib/rucc/op.rb +61 -0
- data/lib/rucc/operator.rb +13 -0
- data/lib/rucc/option.rb +30 -0
- data/lib/rucc/parser.rb +961 -0
- data/lib/rucc/parser/break.rb +18 -0
- data/lib/rucc/parser/builtin.rb +25 -0
- data/lib/rucc/parser/continue.rb +18 -0
- data/lib/rucc/parser/do.rb +33 -0
- data/lib/rucc/parser/ensure.rb +39 -0
- data/lib/rucc/parser/enum.rb +64 -0
- data/lib/rucc/parser/expr.rb +493 -0
- data/lib/rucc/parser/for.rb +71 -0
- data/lib/rucc/parser/func.rb +274 -0
- data/lib/rucc/parser/func_call.rb +54 -0
- data/lib/rucc/parser/goto.rb +29 -0
- data/lib/rucc/parser/if.rb +23 -0
- data/lib/rucc/parser/initializer.rb +237 -0
- data/lib/rucc/parser/label.rb +31 -0
- data/lib/rucc/parser/return.rb +16 -0
- data/lib/rucc/parser/struct_and_union.rb +280 -0
- data/lib/rucc/parser/switch.rb +117 -0
- data/lib/rucc/parser/while.rb +29 -0
- data/lib/rucc/pos.rb +11 -0
- data/lib/rucc/rmap.rb +22 -0
- data/lib/rucc/s.rb +9 -0
- data/lib/rucc/static_label_gen.rb +15 -0
- data/lib/rucc/t.rb +18 -0
- data/lib/rucc/tempname_gen.rb +14 -0
- data/lib/rucc/token.rb +114 -0
- data/lib/rucc/token_gen.rb +68 -0
- data/lib/rucc/type.rb +304 -0
- data/lib/rucc/type/check.rb +39 -0
- data/lib/rucc/type/conv.rb +29 -0
- data/lib/rucc/type_info.rb +21 -0
- data/lib/rucc/utf.rb +126 -0
- data/lib/rucc/util.rb +111 -0
- data/lib/rucc/version.rb +3 -0
- data/rucc.gemspec +38 -0
- metadata +201 -0
| @@ -0,0 +1,39 @@ | |
| 1 | 
            +
            module Rucc
         | 
| 2 | 
            +
              class Type
         | 
| 3 | 
            +
                module Check
         | 
| 4 | 
            +
                  # @param [Type] ty
         | 
| 5 | 
            +
                  # @return [Boolean]
         | 
| 6 | 
            +
                  def is_arithtype(ty)
         | 
| 7 | 
            +
                    is_inttype(ty) || is_flotype(ty)
         | 
| 8 | 
            +
                  end
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                  # @param [Type] ty
         | 
| 11 | 
            +
                  # @return [Boolean]
         | 
| 12 | 
            +
                  def is_inttype(ty)
         | 
| 13 | 
            +
                    case ty.kind
         | 
| 14 | 
            +
                    when Kind::BOOL, Kind::CHAR, Kind::SHORT, Kind::INT, Kind::LONG, Kind::LLONG
         | 
| 15 | 
            +
                      true
         | 
| 16 | 
            +
                    else
         | 
| 17 | 
            +
                      false
         | 
| 18 | 
            +
                    end
         | 
| 19 | 
            +
                  end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                  # @param [Type] ty
         | 
| 22 | 
            +
                  # @return [Boolean]
         | 
| 23 | 
            +
                  def is_flotype(ty)
         | 
| 24 | 
            +
                    case ty.kind
         | 
| 25 | 
            +
                    when Kind::FLOAT, Kind::DOUBLE, Kind::LDOUBLE
         | 
| 26 | 
            +
                      true
         | 
| 27 | 
            +
                    else
         | 
| 28 | 
            +
                      false
         | 
| 29 | 
            +
                    end
         | 
| 30 | 
            +
                  end
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                  # @param [Type] ty
         | 
| 33 | 
            +
                  # @return [Boolean]
         | 
| 34 | 
            +
                  def is_string(ty)
         | 
| 35 | 
            +
                    ty.kind == Kind::ARRAY && ty.ptr.kind == Kind::CHAR
         | 
| 36 | 
            +
                  end
         | 
| 37 | 
            +
                end
         | 
| 38 | 
            +
              end
         | 
| 39 | 
            +
            end
         | 
| @@ -0,0 +1,29 @@ | |
| 1 | 
            +
            require "rucc/util"
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Rucc
         | 
| 4 | 
            +
              class Type
         | 
| 5 | 
            +
                module Conv
         | 
| 6 | 
            +
                  # C11 6.3.1.8: Usual arithmetic conversions
         | 
| 7 | 
            +
                  # @param [Type] t
         | 
| 8 | 
            +
                  # @param [Type] u
         | 
| 9 | 
            +
                  # @return [Type]
         | 
| 10 | 
            +
                  def usual_arith_conv(t, u)
         | 
| 11 | 
            +
                    Util.assert!{ Type.is_arithtype(t) }
         | 
| 12 | 
            +
                    Util.assert!{ Type.is_arithtype(u) }
         | 
| 13 | 
            +
                    if (t.kind < u.kind)
         | 
| 14 | 
            +
                      # Make t the larger type
         | 
| 15 | 
            +
                      t, u = u, t
         | 
| 16 | 
            +
                    end
         | 
| 17 | 
            +
                    return t if Type.is_flotype(t)
         | 
| 18 | 
            +
                    Util.assert!{ Type.is_inttype(t) && t.size >= Type::INT.size }
         | 
| 19 | 
            +
                    Util.assert!{ Type.is_inttype(u) && u.size >= Type::INT.size }
         | 
| 20 | 
            +
                    return t if t.size > u.size
         | 
| 21 | 
            +
                    Util.assert!{ t.size == u.size }
         | 
| 22 | 
            +
                    return t if t.usig == u.usig
         | 
| 23 | 
            +
                    r = t.dup
         | 
| 24 | 
            +
                    r.usig = true
         | 
| 25 | 
            +
                    r
         | 
| 26 | 
            +
                  end
         | 
| 27 | 
            +
                end
         | 
| 28 | 
            +
              end
         | 
| 29 | 
            +
            end
         | 
| @@ -0,0 +1,21 @@ | |
| 1 | 
            +
            module Rucc
         | 
| 2 | 
            +
              # Only used in parser
         | 
| 3 | 
            +
              module TypeInfo
         | 
| 4 | 
            +
                # kind
         | 
| 5 | 
            +
                VOID   = "TypeInfo::VOID"
         | 
| 6 | 
            +
                BOOL   = "TypeInfo::BOOL"
         | 
| 7 | 
            +
                CHAR   = "TypeInfo::CHAR"
         | 
| 8 | 
            +
                INT    = "TypeInfo::INT"
         | 
| 9 | 
            +
                FLOAT  = "TypeInfo::FLOAT"
         | 
| 10 | 
            +
                DOUBLE = "TypeInfo::DOUBLE"
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                # size
         | 
| 13 | 
            +
                SHORT = "TypeInfo::SHORT"
         | 
| 14 | 
            +
                LONG  = "TypeInfo::LONG"
         | 
| 15 | 
            +
                LLONG = "TypeInfo::LLONG"
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                # sig
         | 
| 18 | 
            +
                SIGNED   = "TypeInfo::SIGNED"
         | 
| 19 | 
            +
                UNSIGNED = "TypeInfo::UNSIGNED"
         | 
| 20 | 
            +
              end
         | 
| 21 | 
            +
            end
         | 
    
        data/lib/rucc/utf.rb
    ADDED
    
    | @@ -0,0 +1,126 @@ | |
| 1 | 
            +
            module Rucc
         | 
| 2 | 
            +
              module UTF
         | 
| 3 | 
            +
                class << self
         | 
| 4 | 
            +
                  # @param(return) [String] b
         | 
| 5 | 
            +
                  # @param [Integer] rune
         | 
| 6 | 
            +
                  def write_utf8(b, rune)
         | 
| 7 | 
            +
                    # In ruby, default encoding is UTF-8, so `String#<<` can append rune
         | 
| 8 | 
            +
                    # as UTF-8 string
         | 
| 9 | 
            +
                    b << rune
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                    # if rune < 0x80
         | 
| 12 | 
            +
                    #   b << rune
         | 
| 13 | 
            +
                    #   return
         | 
| 14 | 
            +
                    # end
         | 
| 15 | 
            +
                    # if rune < 0x800
         | 
| 16 | 
            +
                    #   b << (0xC0 | (rune >> 6))
         | 
| 17 | 
            +
                    #   b << (0x80 | (rune & 0x3F))
         | 
| 18 | 
            +
                    #   return
         | 
| 19 | 
            +
                    # end
         | 
| 20 | 
            +
                    # if rune < 0x10000
         | 
| 21 | 
            +
                    #   b << (0xE0 | (rune >> 12))
         | 
| 22 | 
            +
                    #   b << (0x80 | ((rune >> 6) & 0x3F))
         | 
| 23 | 
            +
                    #   b << (0x80 | (rune & 0x3F))
         | 
| 24 | 
            +
                    #   return
         | 
| 25 | 
            +
                    # end
         | 
| 26 | 
            +
                    # if rune < 0x200000
         | 
| 27 | 
            +
                    #   b << (0xF0 | (rune >> 18))
         | 
| 28 | 
            +
                    #   b << (0x80 | ((rune >> 12) & 0x3F))
         | 
| 29 | 
            +
                    #   b << (0x80 | ((rune >> 6) & 0x3F))
         | 
| 30 | 
            +
                    #   b << (0x80 | (rune & 0x3F))
         | 
| 31 | 
            +
                    #   return
         | 
| 32 | 
            +
                    # end
         | 
| 33 | 
            +
                    # raise "invalid UCS character: \\U#{format("%08d", rune)}"
         | 
| 34 | 
            +
                    # error("invalid UCS character: \\U%08x", rune);
         | 
| 35 | 
            +
                  end
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                  # @param [String] str
         | 
| 38 | 
            +
                  # @return [String]
         | 
| 39 | 
            +
                  def to_utf16(str)
         | 
| 40 | 
            +
                    b = ""
         | 
| 41 | 
            +
                    bytes = str.bytes
         | 
| 42 | 
            +
                    while bytes.size > 0
         | 
| 43 | 
            +
                      rune, bytes = read_rune(bytes)
         | 
| 44 | 
            +
                      if rune < 0x10000
         | 
| 45 | 
            +
                        write16(b, rune)
         | 
| 46 | 
            +
                      else
         | 
| 47 | 
            +
                        write16(b, (rune >> 10) + 0xD7C0)
         | 
| 48 | 
            +
                        write16(b, (rune & 0x3FF) + 0xDC00)
         | 
| 49 | 
            +
                      end
         | 
| 50 | 
            +
                    end
         | 
| 51 | 
            +
                    b
         | 
| 52 | 
            +
                  end
         | 
| 53 | 
            +
             | 
| 54 | 
            +
                  # @param [String] str
         | 
| 55 | 
            +
                  # @return [String]
         | 
| 56 | 
            +
                  def to_utf32(str)
         | 
| 57 | 
            +
                    b = ""
         | 
| 58 | 
            +
                    bytes = str.bytes
         | 
| 59 | 
            +
                    while bytes.size > 0
         | 
| 60 | 
            +
                      rune, bytes = read_rune(bytes)
         | 
| 61 | 
            +
                      write32(b, rune)
         | 
| 62 | 
            +
                    end
         | 
| 63 | 
            +
                    b
         | 
| 64 | 
            +
                  end
         | 
| 65 | 
            +
             | 
| 66 | 
            +
                  # @param(return) [String] b
         | 
| 67 | 
            +
                  # @param [Integer] rune
         | 
| 68 | 
            +
                  def write16(b, rune)
         | 
| 69 | 
            +
                    b << (rune & 0xFF)
         | 
| 70 | 
            +
                    b << (rune >> 8)
         | 
| 71 | 
            +
                  end
         | 
| 72 | 
            +
             | 
| 73 | 
            +
                  # @param(return) [String] b
         | 
| 74 | 
            +
                  # @param [Integer] rune
         | 
| 75 | 
            +
                  def write32(b, rune)
         | 
| 76 | 
            +
                    write16(b, rune & 0xFFFF)
         | 
| 77 | 
            +
                    write16(b, rune >> 16)
         | 
| 78 | 
            +
                  end
         | 
| 79 | 
            +
             | 
| 80 | 
            +
                  # @param [<Integer>] s
         | 
| 81 | 
            +
                  # @return [<Integer, <Integer>>]
         | 
| 82 | 
            +
                  def read_rune(s)
         | 
| 83 | 
            +
                    len = count_leading_ones(s[0])
         | 
| 84 | 
            +
                    if len == 0
         | 
| 85 | 
            +
                      return s[0], s[1..-1]
         | 
| 86 | 
            +
                    end
         | 
| 87 | 
            +
                    if len > s.size
         | 
| 88 | 
            +
                      raise "invalid UTF-8 sequence"
         | 
| 89 | 
            +
                      # error("invalid UTF-8 sequence");
         | 
| 90 | 
            +
                    end
         | 
| 91 | 
            +
                    1.upto(len - 1).each do |i|
         | 
| 92 | 
            +
                      if (s[i] & 0xC0) != 0x80
         | 
| 93 | 
            +
                        raise "invalid UTF-8 continuation byte"
         | 
| 94 | 
            +
                        # error("invalid UTF-8 continuation byte");
         | 
| 95 | 
            +
                      end
         | 
| 96 | 
            +
                    end
         | 
| 97 | 
            +
             | 
| 98 | 
            +
                    case len
         | 
| 99 | 
            +
                    when 2
         | 
| 100 | 
            +
                      r = ((s[0] & 0x1F) << 6) | (s[1] & 0x3F)
         | 
| 101 | 
            +
                      return r, s[2..-1]
         | 
| 102 | 
            +
                    when 3
         | 
| 103 | 
            +
                      r = ((s[0] & 0xF) << 12) | ((s[1] & 0x3F) << 6) | (s[2] & 0x3F)
         | 
| 104 | 
            +
                      return r, s[3..-1]
         | 
| 105 | 
            +
                    when 4
         | 
| 106 | 
            +
                      r = ((s[0] & 0x7) << 18) | ((s[1] & 0x3F) << 12) | ((s[2] & 0x3F) << 6) | (s[3] & 0x3F)
         | 
| 107 | 
            +
                      return r, s[4..-1]
         | 
| 108 | 
            +
                    else
         | 
| 109 | 
            +
                      raise "invalid UTF-8 sequence"
         | 
| 110 | 
            +
                      # error("invalid UTF-8 sequence");
         | 
| 111 | 
            +
                    end
         | 
| 112 | 
            +
                  end
         | 
| 113 | 
            +
             | 
| 114 | 
            +
                  # @param [Integer] c
         | 
| 115 | 
            +
                  # @return [Integer]
         | 
| 116 | 
            +
                  def count_leading_ones(c)
         | 
| 117 | 
            +
                    7.downto(0).each do |i|
         | 
| 118 | 
            +
                      if (c & (1 << i)) == 0
         | 
| 119 | 
            +
                        return 7 - i
         | 
| 120 | 
            +
                      end
         | 
| 121 | 
            +
                    end
         | 
| 122 | 
            +
                    8
         | 
| 123 | 
            +
                  end
         | 
| 124 | 
            +
                end
         | 
| 125 | 
            +
              end
         | 
| 126 | 
            +
            end
         | 
    
        data/lib/rucc/util.rb
    ADDED
    
    | @@ -0,0 +1,111 @@ | |
| 1 | 
            +
            module Rucc
         | 
| 2 | 
            +
              module Util
         | 
| 3 | 
            +
                class << self
         | 
| 4 | 
            +
                  ##
         | 
| 5 | 
            +
                  # Quote
         | 
| 6 | 
            +
                  ##
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                  # @param [Char] c
         | 
| 9 | 
            +
                  # @return [char, NilClass] nil when c is not escapetable
         | 
| 10 | 
            +
                  def quote(c)
         | 
| 11 | 
            +
                    case c
         | 
| 12 | 
            +
                    when '"'  then '\\"'
         | 
| 13 | 
            +
                    when "\\" then '\\\\'
         | 
| 14 | 
            +
                    when "\b" then '\\b'
         | 
| 15 | 
            +
                    when "\f" then '\\f'
         | 
| 16 | 
            +
                    when "\n" then '\\n'
         | 
| 17 | 
            +
                    when "\r" then '\\r'
         | 
| 18 | 
            +
                    when "\t" then '\\t'
         | 
| 19 | 
            +
                    when "\v" then '\\x0b'
         | 
| 20 | 
            +
                    else           nil
         | 
| 21 | 
            +
                    end
         | 
| 22 | 
            +
                  end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                  # @param(return) [String] b
         | 
| 25 | 
            +
                  # @param [Char] c
         | 
| 26 | 
            +
                  def quote_append(b, c)
         | 
| 27 | 
            +
                    q = quote(c)
         | 
| 28 | 
            +
                    if q
         | 
| 29 | 
            +
                      b << q
         | 
| 30 | 
            +
                    elsif Libc.isprint(c)
         | 
| 31 | 
            +
                      b << c
         | 
| 32 | 
            +
                    else
         | 
| 33 | 
            +
                      # TODO(south37) Fix this dirty hack.
         | 
| 34 | 
            +
                      # In current impl, "\u00ff" (utf-8 two byte string) and "\xff" (one byte string) can not be distinguished.
         | 
| 35 | 
            +
                      # By using byte array from the beginning, these can be expressed differently.
         | 
| 36 | 
            +
                      if c.ord <= 0xff
         | 
| 37 | 
            +
                        # One byte
         | 
| 38 | 
            +
                        b << ("\\x%02x" % c.ord)
         | 
| 39 | 
            +
                      else
         | 
| 40 | 
            +
                        # Multi bytes
         | 
| 41 | 
            +
                        c.bytes.each do |byte|
         | 
| 42 | 
            +
                          b << ("\\x%02x" % byte)
         | 
| 43 | 
            +
                        end
         | 
| 44 | 
            +
                      end
         | 
| 45 | 
            +
                    end
         | 
| 46 | 
            +
                  end
         | 
| 47 | 
            +
             | 
| 48 | 
            +
                  # @param [String] str
         | 
| 49 | 
            +
                  # @param [Char] c
         | 
| 50 | 
            +
                  # @return [String]
         | 
| 51 | 
            +
                  def quote_cstring(str)
         | 
| 52 | 
            +
                    b = ""
         | 
| 53 | 
            +
                    while (c = str[0])
         | 
| 54 | 
            +
                      quote_append(b, c)
         | 
| 55 | 
            +
                      str = str[1..-1]
         | 
| 56 | 
            +
                    end
         | 
| 57 | 
            +
                    b
         | 
| 58 | 
            +
                  end
         | 
| 59 | 
            +
             | 
| 60 | 
            +
                  # @param [Integer] c
         | 
| 61 | 
            +
                  def quote_char(c)
         | 
| 62 | 
            +
                    return "\\\\" if c == '\\'.ord
         | 
| 63 | 
            +
                    return "\\'"  if c == '\''.ord
         | 
| 64 | 
            +
                    "%c" % c
         | 
| 65 | 
            +
                  end
         | 
| 66 | 
            +
             | 
| 67 | 
            +
                  # @param [Integer] n
         | 
| 68 | 
            +
                  # @return [Integer]
         | 
| 69 | 
            +
                  def ceil8(n)
         | 
| 70 | 
            +
                    rem = n % 8
         | 
| 71 | 
            +
                    (rem == 0) ? n : (n - rem + 8)
         | 
| 72 | 
            +
                  end
         | 
| 73 | 
            +
             | 
| 74 | 
            +
                  ##
         | 
| 75 | 
            +
                  # Error
         | 
| 76 | 
            +
                  ##
         | 
| 77 | 
            +
             | 
| 78 | 
            +
                  # @param [Token] tok
         | 
| 79 | 
            +
                  # @param [String] message
         | 
| 80 | 
            +
                  # @raise [RuntimeError]
         | 
| 81 | 
            +
                  def errort!(tok, message)
         | 
| 82 | 
            +
                    raise_error(token_pos(tok), "ERROR", message)
         | 
| 83 | 
            +
                  end
         | 
| 84 | 
            +
             | 
| 85 | 
            +
                  # @param [Token] tok
         | 
| 86 | 
            +
                  # @return [String]
         | 
| 87 | 
            +
                  def token_pos(tok)
         | 
| 88 | 
            +
                    f = tok.file
         | 
| 89 | 
            +
                    if !f
         | 
| 90 | 
            +
                      return "(unknown)"
         | 
| 91 | 
            +
                    end
         | 
| 92 | 
            +
                    name = f.name || "(unknown)"
         | 
| 93 | 
            +
                    "#{name}:#{tok.line}:#{tok.column}"
         | 
| 94 | 
            +
                  end
         | 
| 95 | 
            +
             | 
| 96 | 
            +
                  def raise_error(pos, label, message)
         | 
| 97 | 
            +
                    raise "[#{label}] #{pos}: #{message}"
         | 
| 98 | 
            +
                  end
         | 
| 99 | 
            +
             | 
| 100 | 
            +
                  ##
         | 
| 101 | 
            +
                  # Assert
         | 
| 102 | 
            +
                  ##
         | 
| 103 | 
            +
             | 
| 104 | 
            +
                  class AssertError < RuntimeError; end
         | 
| 105 | 
            +
             | 
| 106 | 
            +
                  def assert!(&block)
         | 
| 107 | 
            +
                    raise AssertError.new("Assertion failed!") if !block.call
         | 
| 108 | 
            +
                  end
         | 
| 109 | 
            +
                end
         | 
| 110 | 
            +
              end
         | 
| 111 | 
            +
            end
         | 
    
        data/lib/rucc/version.rb
    ADDED
    
    
    
        data/rucc.gemspec
    ADDED
    
    | @@ -0,0 +1,38 @@ | |
| 1 | 
            +
             | 
| 2 | 
            +
            lib = File.expand_path("../lib", __FILE__)
         | 
| 3 | 
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         | 
| 4 | 
            +
            require "rucc/version"
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            Gem::Specification.new do |spec|
         | 
| 7 | 
            +
              spec.name          = "rucc"
         | 
| 8 | 
            +
              spec.version       = Rucc::VERSION
         | 
| 9 | 
            +
              spec.authors       = ["Nao Minami"]
         | 
| 10 | 
            +
              spec.email         = ["south37777@gmail.com"]
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              spec.summary       = %q{C compiler written in Ruby.}
         | 
| 13 | 
            +
              spec.description   = %q{C compiler written in Ruby.}
         | 
| 14 | 
            +
              spec.homepage      = "https://github.com/south37/rucc"
         | 
| 15 | 
            +
              spec.license       = "MIT"
         | 
| 16 | 
            +
             | 
| 17 | 
            +
              # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
         | 
| 18 | 
            +
              # to allow pushing to a single host or delete this section to allow pushing to any host.
         | 
| 19 | 
            +
              if spec.respond_to?(:metadata)
         | 
| 20 | 
            +
                spec.metadata["allowed_push_host"] = "https://rubygems.org"
         | 
| 21 | 
            +
              else
         | 
| 22 | 
            +
                raise "RubyGems 2.0 or newer is required to protect against " \
         | 
| 23 | 
            +
                  "public gem pushes."
         | 
| 24 | 
            +
              end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
              spec.files         = `git ls-files -z`.split("\x0").reject do |f|
         | 
| 27 | 
            +
                f.match(%r{^(test|spec|features)/})
         | 
| 28 | 
            +
              end
         | 
| 29 | 
            +
              spec.bindir        = "exe"
         | 
| 30 | 
            +
              spec.executables   = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
         | 
| 31 | 
            +
              spec.require_paths = ["lib"]
         | 
| 32 | 
            +
             | 
| 33 | 
            +
              spec.add_development_dependency "bundler", "~> 1.16"
         | 
| 34 | 
            +
              spec.add_development_dependency "rake", "~> 10.0"
         | 
| 35 | 
            +
              spec.add_development_dependency "rspec", "~> 3.7.0"
         | 
| 36 | 
            +
              spec.add_development_dependency "pry"
         | 
| 37 | 
            +
              spec.add_development_dependency "pry-byebug"
         | 
| 38 | 
            +
            end
         | 
    
        metadata
    ADDED
    
    | @@ -0,0 +1,201 @@ | |
| 1 | 
            +
            --- !ruby/object:Gem::Specification
         | 
| 2 | 
            +
            name: rucc
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            +
              version: 0.1.0
         | 
| 5 | 
            +
            platform: ruby
         | 
| 6 | 
            +
            authors:
         | 
| 7 | 
            +
            - Nao Minami
         | 
| 8 | 
            +
            autorequire: 
         | 
| 9 | 
            +
            bindir: exe
         | 
| 10 | 
            +
            cert_chain: []
         | 
| 11 | 
            +
            date: 2018-01-25 00:00:00.000000000 Z
         | 
| 12 | 
            +
            dependencies:
         | 
| 13 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 14 | 
            +
              name: bundler
         | 
| 15 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 | 
            +
                requirements:
         | 
| 17 | 
            +
                - - "~>"
         | 
| 18 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            +
                    version: '1.16'
         | 
| 20 | 
            +
              type: :development
         | 
| 21 | 
            +
              prerelease: false
         | 
| 22 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 | 
            +
                requirements:
         | 
| 24 | 
            +
                - - "~>"
         | 
| 25 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            +
                    version: '1.16'
         | 
| 27 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 28 | 
            +
              name: rake
         | 
| 29 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 | 
            +
                requirements:
         | 
| 31 | 
            +
                - - "~>"
         | 
| 32 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            +
                    version: '10.0'
         | 
| 34 | 
            +
              type: :development
         | 
| 35 | 
            +
              prerelease: false
         | 
| 36 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 | 
            +
                requirements:
         | 
| 38 | 
            +
                - - "~>"
         | 
| 39 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            +
                    version: '10.0'
         | 
| 41 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 42 | 
            +
              name: rspec
         | 
| 43 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 | 
            +
                requirements:
         | 
| 45 | 
            +
                - - "~>"
         | 
| 46 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 47 | 
            +
                    version: 3.7.0
         | 
| 48 | 
            +
              type: :development
         | 
| 49 | 
            +
              prerelease: false
         | 
| 50 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 | 
            +
                requirements:
         | 
| 52 | 
            +
                - - "~>"
         | 
| 53 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            +
                    version: 3.7.0
         | 
| 55 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 56 | 
            +
              name: pry
         | 
| 57 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 58 | 
            +
                requirements:
         | 
| 59 | 
            +
                - - ">="
         | 
| 60 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            +
                    version: '0'
         | 
| 62 | 
            +
              type: :development
         | 
| 63 | 
            +
              prerelease: false
         | 
| 64 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 65 | 
            +
                requirements:
         | 
| 66 | 
            +
                - - ">="
         | 
| 67 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 68 | 
            +
                    version: '0'
         | 
| 69 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 70 | 
            +
              name: pry-byebug
         | 
| 71 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 72 | 
            +
                requirements:
         | 
| 73 | 
            +
                - - ">="
         | 
| 74 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 75 | 
            +
                    version: '0'
         | 
| 76 | 
            +
              type: :development
         | 
| 77 | 
            +
              prerelease: false
         | 
| 78 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 79 | 
            +
                requirements:
         | 
| 80 | 
            +
                - - ">="
         | 
| 81 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 82 | 
            +
                    version: '0'
         | 
| 83 | 
            +
            description: C compiler written in Ruby.
         | 
| 84 | 
            +
            email:
         | 
| 85 | 
            +
            - south37777@gmail.com
         | 
| 86 | 
            +
            executables:
         | 
| 87 | 
            +
            - rucc
         | 
| 88 | 
            +
            extensions: []
         | 
| 89 | 
            +
            extra_rdoc_files: []
         | 
| 90 | 
            +
            files:
         | 
| 91 | 
            +
            - ".gitignore"
         | 
| 92 | 
            +
            - ".rspec"
         | 
| 93 | 
            +
            - ".travis.yml"
         | 
| 94 | 
            +
            - Gemfile
         | 
| 95 | 
            +
            - Gemfile.lock
         | 
| 96 | 
            +
            - LICENCE
         | 
| 97 | 
            +
            - README.md
         | 
| 98 | 
            +
            - Rakefile
         | 
| 99 | 
            +
            - Vagrantfile
         | 
| 100 | 
            +
            - bin/console
         | 
| 101 | 
            +
            - bin/rspec
         | 
| 102 | 
            +
            - bin/setup
         | 
| 103 | 
            +
            - exe/rucc
         | 
| 104 | 
            +
            - include/8cc.h
         | 
| 105 | 
            +
            - include/float.h
         | 
| 106 | 
            +
            - include/iso646.h
         | 
| 107 | 
            +
            - include/rucc.h
         | 
| 108 | 
            +
            - include/stdalign.h
         | 
| 109 | 
            +
            - include/stdarg.h
         | 
| 110 | 
            +
            - include/stdbool.h
         | 
| 111 | 
            +
            - include/stddef.h
         | 
| 112 | 
            +
            - include/stdnoreturn.h
         | 
| 113 | 
            +
            - lib/rucc.rb
         | 
| 114 | 
            +
            - lib/rucc/case.rb
         | 
| 115 | 
            +
            - lib/rucc/decl.rb
         | 
| 116 | 
            +
            - lib/rucc/enc.rb
         | 
| 117 | 
            +
            - lib/rucc/engine.rb
         | 
| 118 | 
            +
            - lib/rucc/file_io.rb
         | 
| 119 | 
            +
            - lib/rucc/file_io_list.rb
         | 
| 120 | 
            +
            - lib/rucc/gen.rb
         | 
| 121 | 
            +
            - lib/rucc/int_evaluator.rb
         | 
| 122 | 
            +
            - lib/rucc/k.rb
         | 
| 123 | 
            +
            - lib/rucc/keyword.rb
         | 
| 124 | 
            +
            - lib/rucc/kind.rb
         | 
| 125 | 
            +
            - lib/rucc/label_gen.rb
         | 
| 126 | 
            +
            - lib/rucc/lexer.rb
         | 
| 127 | 
            +
            - lib/rucc/lexer/impl.rb
         | 
| 128 | 
            +
            - lib/rucc/lexer/preprocessor.rb
         | 
| 129 | 
            +
            - lib/rucc/lexer/preprocessor/cond_incl.rb
         | 
| 130 | 
            +
            - lib/rucc/lexer/preprocessor/constructor.rb
         | 
| 131 | 
            +
            - lib/rucc/lexer/preprocessor/pragma.rb
         | 
| 132 | 
            +
            - lib/rucc/lexer/preprocessor/special_macro.rb
         | 
| 133 | 
            +
            - lib/rucc/libc.rb
         | 
| 134 | 
            +
            - lib/rucc/m.rb
         | 
| 135 | 
            +
            - lib/rucc/macro.rb
         | 
| 136 | 
            +
            - lib/rucc/node.rb
         | 
| 137 | 
            +
            - lib/rucc/node/conv.rb
         | 
| 138 | 
            +
            - lib/rucc/op.rb
         | 
| 139 | 
            +
            - lib/rucc/operator.rb
         | 
| 140 | 
            +
            - lib/rucc/option.rb
         | 
| 141 | 
            +
            - lib/rucc/parser.rb
         | 
| 142 | 
            +
            - lib/rucc/parser/break.rb
         | 
| 143 | 
            +
            - lib/rucc/parser/builtin.rb
         | 
| 144 | 
            +
            - lib/rucc/parser/continue.rb
         | 
| 145 | 
            +
            - lib/rucc/parser/do.rb
         | 
| 146 | 
            +
            - lib/rucc/parser/ensure.rb
         | 
| 147 | 
            +
            - lib/rucc/parser/enum.rb
         | 
| 148 | 
            +
            - lib/rucc/parser/expr.rb
         | 
| 149 | 
            +
            - lib/rucc/parser/for.rb
         | 
| 150 | 
            +
            - lib/rucc/parser/func.rb
         | 
| 151 | 
            +
            - lib/rucc/parser/func_call.rb
         | 
| 152 | 
            +
            - lib/rucc/parser/goto.rb
         | 
| 153 | 
            +
            - lib/rucc/parser/if.rb
         | 
| 154 | 
            +
            - lib/rucc/parser/initializer.rb
         | 
| 155 | 
            +
            - lib/rucc/parser/label.rb
         | 
| 156 | 
            +
            - lib/rucc/parser/return.rb
         | 
| 157 | 
            +
            - lib/rucc/parser/struct_and_union.rb
         | 
| 158 | 
            +
            - lib/rucc/parser/switch.rb
         | 
| 159 | 
            +
            - lib/rucc/parser/while.rb
         | 
| 160 | 
            +
            - lib/rucc/pos.rb
         | 
| 161 | 
            +
            - lib/rucc/rmap.rb
         | 
| 162 | 
            +
            - lib/rucc/s.rb
         | 
| 163 | 
            +
            - lib/rucc/static_label_gen.rb
         | 
| 164 | 
            +
            - lib/rucc/t.rb
         | 
| 165 | 
            +
            - lib/rucc/tempname_gen.rb
         | 
| 166 | 
            +
            - lib/rucc/token.rb
         | 
| 167 | 
            +
            - lib/rucc/token_gen.rb
         | 
| 168 | 
            +
            - lib/rucc/type.rb
         | 
| 169 | 
            +
            - lib/rucc/type/check.rb
         | 
| 170 | 
            +
            - lib/rucc/type/conv.rb
         | 
| 171 | 
            +
            - lib/rucc/type_info.rb
         | 
| 172 | 
            +
            - lib/rucc/utf.rb
         | 
| 173 | 
            +
            - lib/rucc/util.rb
         | 
| 174 | 
            +
            - lib/rucc/version.rb
         | 
| 175 | 
            +
            - rucc.gemspec
         | 
| 176 | 
            +
            homepage: https://github.com/south37/rucc
         | 
| 177 | 
            +
            licenses:
         | 
| 178 | 
            +
            - MIT
         | 
| 179 | 
            +
            metadata:
         | 
| 180 | 
            +
              allowed_push_host: https://rubygems.org
         | 
| 181 | 
            +
            post_install_message: 
         | 
| 182 | 
            +
            rdoc_options: []
         | 
| 183 | 
            +
            require_paths:
         | 
| 184 | 
            +
            - lib
         | 
| 185 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 186 | 
            +
              requirements:
         | 
| 187 | 
            +
              - - ">="
         | 
| 188 | 
            +
                - !ruby/object:Gem::Version
         | 
| 189 | 
            +
                  version: '0'
         | 
| 190 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 191 | 
            +
              requirements:
         | 
| 192 | 
            +
              - - ">="
         | 
| 193 | 
            +
                - !ruby/object:Gem::Version
         | 
| 194 | 
            +
                  version: '0'
         | 
| 195 | 
            +
            requirements: []
         | 
| 196 | 
            +
            rubyforge_project: 
         | 
| 197 | 
            +
            rubygems_version: 2.7.3
         | 
| 198 | 
            +
            signing_key: 
         | 
| 199 | 
            +
            specification_version: 4
         | 
| 200 | 
            +
            summary: C compiler written in Ruby.
         | 
| 201 | 
            +
            test_files: []
         |