chelsy 0.0.3 → 0.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2e2b87298eca205d1b4c4783ab090559a971e749
4
- data.tar.gz: f068070509af5a93eed85179a011bd9234f09f0d
3
+ metadata.gz: 56cad98ddddf30558dd50bde2947f90b785fea1b
4
+ data.tar.gz: 52271a3c6e50b65b1961316cd11ce5d9160226d5
5
5
  SHA512:
6
- metadata.gz: a8a4defd43ff48249e937060ac12765ebd740e5a432acfcc97500136a124d4c930db949a6778d25da8b06d342bcdb8dd4da662857926d33852d63c0394fee335
7
- data.tar.gz: a0b5f5c7e59a7ad34e9f49b7087f8c745240797c4008ea25ecbf4511be4aa2c6a60878aedcc7583eac32b3343fe1a2d3f9dc8fd4ce6a085fccd6c52351976b76
6
+ metadata.gz: fe0511b66fc3ba2ca8c0e7a04eec0ae9298bea40ffba516bc367bc5017b3ba29f2deef4bc553eb0fc91be520cec55b3f41894753f3eefed9778348c460f82aac
7
+ data.tar.gz: 6b9c4b85d08f88956c60735a9fd72d4c04d4dbe0415eb0fd1a179aa7af2a46cc9c59ed4770761fd9b1ecda766bdd0021e6e1508e8b677fcbcfe78fd2d4e74f26
data/.travis.yml CHANGED
@@ -2,4 +2,5 @@ sudo: false
2
2
  language: ruby
3
3
  rvm:
4
4
  - 2.0.0
5
+ - 2.2.0
5
6
  before_install: gem install bundler -v 1.13.2
data/.yardopts ADDED
@@ -0,0 +1 @@
1
+ -m markdown
data/README.md CHANGED
@@ -1,8 +1,18 @@
1
1
  # Chelsy
2
2
 
3
- TODO
3
+ [![API References](https://img.shields.io/badge/doc-api-blue.svg)](http://www.rubydoc.info/gems/chelsy)
4
+ [![Build Status](https://travis-ci.org/ishikawa/chelsy.svg?branch=master)](https://travis-ci.org/ishikawa/chelsy)
5
+ [![Gem](https://img.shields.io/gem/v/chelsy.svg)](https://rubygems.org/gems/chelsy)
4
6
 
5
- It is currently heavily under development. I'm just having some fun.
7
+ > C code generator written in Ruby
8
+
9
+ **Chelsy** is C code generator library written in Ruby. You can construct AST objects and then transform it to C code.
10
+
11
+ ## Table of Contents
12
+
13
+ - [Installation](#installation)
14
+ - [Usage](#usage)
15
+ - [License](#license)
6
16
 
7
17
  ## Installation
8
18
 
@@ -22,13 +32,35 @@ Or install it yourself as:
22
32
 
23
33
  ## Usage
24
34
 
25
- TODO
35
+ ```ruby
36
+ require 'chelsy'
37
+
38
+ include Chelsy
39
+
40
+ doc = Document.new
26
41
 
27
- ## Development
42
+ doc.fragments << Directive::Include.new("stdio.h", system: true)
28
43
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
44
+ doc << Function.new(:main, Type::Int.new, [:void]) do |b|
45
+ b << Operator::Call.new(:printf, [Constant::String.new("Hello, Chelsy!\n")])
46
+ b << Return.new(Constant::Int.new(0))
47
+ end
48
+
49
+ puts Translator.new.translate(doc)
50
+ ```
51
+
52
+ This script generates famous "Hello, World!" C program.
53
+
54
+ ```c
55
+ #include <stdio.h>
56
+
57
+ int main(void) {
58
+ printf("Hello, Chelsy!\n");
59
+ return 0;
60
+ }
61
+ ```
30
62
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
63
+ See [sample](https://github.com/ishikawa/chelsy/tree/master/sample) directory to find more samples.
32
64
 
33
65
  ## License
34
66
 
data/chelsy.gemspec CHANGED
@@ -4,15 +4,15 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'chelsy/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "chelsy"
7
+ spec.name = 'chelsy'
8
8
  spec.version = Chelsy::VERSION
9
- spec.authors = ["Takanori Ishikawa"]
10
- spec.email = ["takanori.ishikawa@gmail.com"]
9
+ spec.authors = ['Takanori Ishikawa']
10
+ spec.email = ['takanori.ishikawa@gmail.com']
11
11
 
12
- spec.homepage = "https://github.com/ishikawa/chelsy"
13
- spec.summary = "C code generator"
14
- spec.description = "C code generator written in Ruby (Work in progress)"
15
- spec.license = "MIT"
12
+ spec.homepage = 'https://github.com/ishikawa/chelsy'
13
+ spec.summary = 'C code generator written in Ruby'
14
+ spec.description = 'C code generator written in Ruby'
15
+ spec.license = 'MIT'
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
18
  f.match(%r{^(test|spec|features)/})
@@ -20,8 +20,9 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.required_ruby_version = '~> 2.0'
22
22
 
23
- spec.add_development_dependency "bundler", "~> 1.13"
24
- spec.add_development_dependency "rake", "~> 10.0"
25
- spec.add_development_dependency "minitest", "~> 5.0"
26
- spec.add_development_dependency "pry", "~> 0.10.4"
23
+ spec.add_development_dependency 'bundler', '~> 1.13'
24
+ spec.add_development_dependency 'rake', '~> 10.0'
25
+ spec.add_development_dependency 'minitest', '~> 5.0'
26
+ spec.add_development_dependency 'pry', '~> 0.10.4'
27
+ spec.add_development_dependency 'yard', '~> 0.9.5'
27
28
  end