rgo-lang 0.1.0 → 0.1.1

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.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +2 -2
  4. data/exe/rgo +23 -4
  5. data/lib/rgo/version.rb +1 -1
  6. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49cf1b3909a9929f80a298023b6b670175718b022dfde44a50b244debfb21796
4
- data.tar.gz: 18fb793ded646ec98e10bac37ad0977784d02de29ad0251c5cf6e59a8d0be3dc
3
+ metadata.gz: fce39ab840f5d3a4eebf64b00f1fde18dd53aa5766ff4ca7aff51c93f8c29625
4
+ data.tar.gz: 34945dac88d2691932c3de58f3f62b6f05d404db954f1696fa3acc2434ea0eb0
5
5
  SHA512:
6
- metadata.gz: f03d84532af30021f877913dbbcbeabd9de3c4fd047995aebe2cb283ed31ee4e52ea493dca0f50d7fe54650bd368d58c8360a6732986dd18d29190c8076b8fad
7
- data.tar.gz: 6bea210b2aeea3ee35e3e88bb9a49050e2a0d40b3d3ae99b8df38d66556dc477efadbfd8475a7a86f50d64e0126dad32f191576326218c6003c10026dc0f5e19
6
+ metadata.gz: 47a80ba3426908955ba500086a30c5dc5ef15ec072956a4b13819d931743a994ab4fd2a33fc9bb6212f75394860d88de98450bb2f96b8de3efd0ce948c7de85e
7
+ data.tar.gz: efaf3127502edd7b575815ad197dcf67da7375a1da1698b39a43f4c63685d3cb15ded585c1d01958a792359ffe9dc8e6ad2ff3ee6bfdc5ff0f818fc4d37421ab
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rgo-lang (0.1.0)
4
+ rgo-lang (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -4,11 +4,11 @@ Ruby like programming language, syntax by Ruby, Performance by Go
4
4
 
5
5
  ## Installation
6
6
 
7
- not published as a gem yet
7
+ $ gem install rgo-lang
8
8
 
9
9
  ## Usage
10
10
 
11
- $ rgo hello_world.rgo
11
+ $ rgo run hello_world.rgo
12
12
 
13
13
  checkout [Samples](samples)
14
14
 
data/exe/rgo CHANGED
@@ -1,15 +1,34 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'rgo'
3
+ require 'tempfile'
3
4
 
4
- unless ARGV.count == 1
5
+ if ARGV.count != 2 || !['compile', 'build', 'run'].include?(ARGV[0])
5
6
  puts "help: "
6
- puts " rgo hello_world.rgo"
7
+ puts " rgo COMMAND filepath.rgo"
8
+ puts ""
9
+ puts "available commands: "
10
+ puts " run"
11
+ puts " build"
7
12
 
8
13
  exit
9
14
  end
10
15
 
11
- filepath = ARGV.first
16
+ filepath = ARGV[1]
12
17
 
13
18
  statements = Rgo::Parser.new.parse(File.read(filepath))
14
- puts Rgo::Compile.new(statements).compile
19
+ compiled_source = Rgo::Compile.new(statements).compile
15
20
 
21
+ case ARGV[0]
22
+ when 'run'
23
+ compiled_file = Tempfile.new(['rgo_temp_', '.go'])
24
+ compiled_file.write(compiled_source)
25
+ compiled_file.close
26
+
27
+ puts `go run #{compiled_file.path}`
28
+ when 'build'
29
+ compiled_file = Tempfile.new(['rgo_temp_', '.go'])
30
+ compiled_file.write(compiled_source)
31
+ compiled_file.close
32
+
33
+ `go build -o #{File.basename(filepath, ".*")} #{compiled_file.path}`
34
+ end
@@ -1,3 +1,3 @@
1
1
  module Rgo
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rgo-lang
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mohsen Alizadeh
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-05 00:00:00.000000000 Z
11
+ date: 2020-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: racc