hilbert 0.0.2700001 → 0.0.2700100

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: 8fd42993b7f3a7468a22b3a27c87106933b2d103
4
- data.tar.gz: 63692355f00bae1ba2f6e64b18dc68430246d82b
3
+ metadata.gz: 9a0a3fec8ea8685b98cb92d396c58fb3467b85cf
4
+ data.tar.gz: 521413e76c6b6512e462695a6603d697da6b1a60
5
5
  SHA512:
6
- metadata.gz: a10b5ce2eb9dc7a5ed093136b0a93f9c71b9efc6c942abe95664344127a7dc6641c7f4785504211d3acbb2cb3e5e3a8a540c0d252331223fb4c419dded3c0e52
7
- data.tar.gz: 5ba9c0c6320dc87989ef4979d0ab89c783006843b0cd9db6bd881710a46c1c374225b2a788253ff5aa5e60591f7312d5c2dc179565db241acbf040f605659787
6
+ metadata.gz: 490d8872bf5cc5c9efea975fe3d596981080844229024916adaf35bbe607831a2f431b331490a91fd4dff83582ca836ff4ac19870b57713b9392bea46a70b4ee
7
+ data.tar.gz: 154c250c7a531e80b939bcc1ed8e382489ff1a9068240ea4118e5da29e7f7c01a071c7228157472e262d63bafc6bd72fac4b83eb29e0bff386b81950f1abd224
data/.coveralls.yml CHANGED
@@ -1,2 +1,2 @@
1
- repo_token: ZdXKADwEPNW5PJkIaC76yjqq4w04dIpuZ
1
+ repo_token: vkYcufANxPOOehtDBT4iHTX1xcWieP3px
2
2
  service_name: travis-ci
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Hilbert
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/hilbert.svg)](http://badge.fury.io/rb/hilbert) [![Build Status](https://travis-ci.org/gogotanaka/Q.svg?branch=master)](https://travis-ci.org/gogotanaka/Q) [![Coverage Status](https://coveralls.io/repos/gogotanaka/Q/badge.png?branch=master)](https://coveralls.io/r/gogotanaka/Q?branch=master) [![Code Climate](https://codeclimate.com/github/gogotanaka/Q/badges/gpa.svg)](https://codeclimate.com/github/gogotanaka/Q) [![Dependency Status](https://gemnasium.com/gogotanaka/Q.svg)](https://gemnasium.com/gogotanaka/Q)
3
+ [![Gem Version](https://badge.fury.io/rb/hilbert.svg)](http://badge.fury.io/rb/hilbert) [![Build Status](https://travis-ci.org/gogotanaka/Hilbert.svg?branch=master)](https://travis-ci.org/gogotanaka/Hilbert) [![Coverage Status](https://coveralls.io/repos/gogotanaka/Hilbert/badge.png?branch=master)](https://coveralls.io/r/gogotanaka/Hilbert?branch=master) [![Code Climate](https://codeclimate.com/github/gogotanaka/Hilbert/badges/gpa.svg)](https://codeclimate.com/github/gogotanaka/Hilbert) [![Dependency Status](https://gemnasium.com/gogotanaka/Hilbert.svg)](https://gemnasium.com/gogotanaka/Hilbert)
4
4
 
5
5
  ## Do you know the one best language in this world?
6
6
 
@@ -103,7 +103,7 @@ Install hilbert gem.
103
103
  ## Interpreter
104
104
 
105
105
  $ hilbert -i
106
- Hilbert:->
106
+ Enjoy! ->
107
107
 
108
108
  ## Use as native language
109
109
 
data/bin/hilbert CHANGED
@@ -2,17 +2,17 @@
2
2
 
3
3
  require 'hilbert'
4
4
 
5
- # Q command line
5
+ # Hilbert command line
6
6
  require 'hilbert/exec'
7
7
 
8
- # Q interpreter
8
+ # Hilbert interpreter
9
9
  require 'hilbert/iq'
10
10
 
11
11
  # TODO: There are vanch of todo ..
12
12
  case ARGV.first
13
13
  when '-i'
14
14
  loop do
15
- print 'Q:-> '
15
+ print 'Enjoy! -> '
16
16
  begin
17
17
  input = $stdin.gets
18
18
  output = Hilbert::Iq.execute(input)
data/core/Q/Lexer.hs CHANGED
@@ -1,9 +1,9 @@
1
1
  {- |
2
- Module : Language.Q
2
+ Module : Language.Hilbert
3
3
  Copyright : Kazuki Tanaka (a.k.a gogotanaka)
4
4
  Licence : MIT
5
5
 
6
6
  q-language.org.
7
7
  -}
8
8
 
9
- module Q.Lexer where
9
+ module Hilbert.Lexer where
data/core/Q/Parser.hs CHANGED
@@ -1,9 +1,9 @@
1
1
  {- |
2
- Module : Language.Q
2
+ Module : Language.Hilbert
3
3
  Copyright : Kazuki Tanaka (a.k.a gogotanaka)
4
4
  Licence : MIT
5
5
 
6
6
  q-language.org.
7
7
  -}
8
8
 
9
- module Q.Parser where
9
+ module Hilbert.Parser where
data/core/Q.hs CHANGED
@@ -1,19 +1,19 @@
1
1
  {- |
2
- Module : Language.Q
2
+ Module : Language.Hilbert
3
3
  Copyright : Kazuki Tanaka (a.k.a gogotanaka)
4
4
  Licence : MIT
5
5
 
6
6
  q-language.org.
7
7
  -}
8
8
 
9
- module Q
10
- ( module Q.Lexer
11
- , module Q.Parser
9
+ module Hilbert
10
+ ( module Hilbert.Lexer
11
+ , module Hilbert.Parser
12
12
  , version
13
13
  ) where
14
14
 
15
15
 
16
- import Q.Lexer
17
- import Q.Parser
16
+ import Hilbert.Lexer
17
+ import Hilbert.Parser
18
18
 
19
19
  import Data.Version
@@ -51,15 +51,15 @@ execute(VALUE self, VALUE a, VALUE b, VALUE n)
51
51
  void
52
52
  Init_hilbert(void)
53
53
  {
54
- VALUE rb_mQMatrix = rb_define_class("QMatrix", rb_cObject);
55
- rb_define_method(rb_mQMatrix, "execute", execute, 3);
56
- rb_define_method(rb_mQMatrix, "func", rb_func, 1);
54
+ VALUE rb_mHilbertMatrix = rb_define_class("HilbertMatrix", rb_cObject);
55
+ rb_define_method(rb_mHilbertMatrix, "execute", execute, 3);
56
+ rb_define_method(rb_mHilbertMatrix, "func", rb_func, 1);
57
57
  }
58
58
 
59
- // VALUE rb_mQMatrix;
59
+ // VALUE rb_mHilbertMatrix;
60
60
 
61
61
  // void
62
62
  // Init_q_matrix(void)
63
63
  // {
64
- // rb_mQMatrix = rb_define_module("QMatrix");
64
+ // rb_mHilbertMatrix = rb_define_module("HilbertMatrix");
65
65
  // }
@@ -1,6 +1,6 @@
1
- #ifndef QLANG_H
2
- #define QLANG_H 1
1
+ #ifndef HilbertLANG_H
2
+ #define HilbertLANG_H 1
3
3
 
4
4
  #include "ruby.h"
5
5
 
6
- #endif /* QLANG_H */
6
+ #endif /* HilbertLANG_H */
data/hilbert.gemspec CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
20
  spec.require_paths = ['lib']
21
21
 
22
- spec.add_dependency 'dydx', '~> 0.1.41421'
22
+ spec.add_dependency 'dydx', '~> 0.2.7000000'
23
23
 
24
24
  spec.add_development_dependency 'bundler'
25
25
  spec.add_development_dependency 'rake'
@@ -4,25 +4,25 @@ describe Hilbert do
4
4
  describe 'List' do
5
5
  it do
6
6
  # expect(
7
- # Q.to_r.compile('{name: "Gogotanaka", age: 21, birth: (1992 8 10) }')
7
+ # Hilbert.to_r.compile('{name: "Gogotanaka", age: 21, birth: (1992 8 10) }')
8
8
  # ).to eq(
9
9
  # "list(name=\"Gogotanaka\", age=21, birth=c(1992, 8, 10))"
10
10
  # )
11
11
 
12
12
  expect(
13
- Q.to_r.compile('{key1: 234234, key2: 387342 }')
13
+ Hilbert.to_r.compile('{key1: 234234, key2: 387342 }')
14
14
  ).to eq(
15
15
  'list(key1=234234, key2=387342)'
16
16
  )
17
17
 
18
18
  expect(
19
- Q.to_r.compile('{key1:234234,key2:387342,key3:38733242}')
19
+ Hilbert.to_r.compile('{key1:234234,key2:387342,key3:38733242}')
20
20
  ).to eq(
21
21
  'list(key1=234234, key2=387342, key3=38733242)'
22
22
  )
23
23
 
24
24
  # expect(
25
- # Q.to_r.compile('{key1:(1 3 2; 8 2 3),key2:387342,key3:38733242}')
25
+ # Hilbert.to_r.compile('{key1:(1 3 2; 8 2 3),key2:387342,key3:38733242}')
26
26
  # ).to eq(
27
27
  # "list(key1=matrix(c(1, 3, 2, 8, 2, 3), 2, 3, byrow = TRUE), key2=387342, key3=38733242)"
28
28
  # )
@@ -5,25 +5,25 @@ describe Hilbert do
5
5
  context 'into R' do
6
6
  it do
7
7
  expect(
8
- Q.to_r.compile('(1 2 3; 4 5 6)')
8
+ Hilbert.to_r.compile('(1 2 3; 4 5 6)')
9
9
  ).to eq(
10
10
  'matrix(c(1, 2, 3, 4, 5, 6), 2, 3, byrow = TRUE)'
11
11
  )
12
12
 
13
13
  expect(
14
- Q.to_r.compile('(1 2 3 ; 4 5 6)')
14
+ Hilbert.to_r.compile('(1 2 3 ; 4 5 6)')
15
15
  ).to eq(
16
16
  'matrix(c(1, 2, 3, 4, 5, 6), 2, 3, byrow = TRUE)'
17
17
  )
18
18
 
19
19
  expect(
20
- Q.to_r.compile('(1 2 3 ; 4 5 6; 7 8 9)')
20
+ Hilbert.to_r.compile('(1 2 3 ; 4 5 6; 7 8 9)')
21
21
  ).to eq(
22
22
  'matrix(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 3, byrow = TRUE)'
23
23
  )
24
24
 
25
25
  expect(
26
- Q.to_r.compile('(1;2;3)')
26
+ Hilbert.to_r.compile('(1;2;3)')
27
27
  ).to eq(
28
28
  'matrix(c(1, 2, 3), 3, 1, byrow = TRUE)'
29
29
  )
@@ -33,19 +33,19 @@ describe Hilbert do
33
33
  context 'into Ruby' do
34
34
  it do
35
35
  expect(
36
- Q.to_ruby.compile('(1 2 3; 4 5 6)')
36
+ Hilbert.to_ruby.compile('(1 2 3; 4 5 6)')
37
37
  ).to eq(
38
38
  'Matrix[[1, 2, 3], [4, 5, 6]]'
39
39
  )
40
40
 
41
41
  expect(
42
- Q.to_ruby.compile('(1 2 3 ; 4 5 6; 7 8 9)')
42
+ Hilbert.to_ruby.compile('(1 2 3 ; 4 5 6; 7 8 9)')
43
43
  ).to eq(
44
44
  'Matrix[[1, 2, 3], [4, 5, 6], [7, 8, 9]]'
45
45
  )
46
46
 
47
47
  expect(
48
- Q.to_ruby.compile('(1;2;3)')
48
+ Hilbert.to_ruby.compile('(1;2;3)')
49
49
  ).to eq(
50
50
  'Matrix[[1], [2], [3]]'
51
51
  )
@@ -5,19 +5,19 @@ describe Hilbert do
5
5
  context 'into R' do
6
6
  it do
7
7
  expect(
8
- Q.to_r.compile('(1 2 3)')
8
+ Hilbert.to_r.compile('(1 2 3)')
9
9
  ).to eq(
10
10
  'c(1, 2, 3)'
11
11
  )
12
12
 
13
13
  expect(
14
- Q.to_r.compile('(1 2 3 4 5 6)')
14
+ Hilbert.to_r.compile('(1 2 3 4 5 6)')
15
15
  ).to eq(
16
16
  'c(1, 2, 3, 4, 5, 6)'
17
17
  )
18
18
 
19
19
  expect(
20
- Q.to_r.compile('(1 2 3 4 5 6)')
20
+ Hilbert.to_r.compile('(1 2 3 4 5 6)')
21
21
  ).to eq(
22
22
  'c(1, 2, 3, 4, 5, 6)'
23
23
  )
@@ -27,7 +27,7 @@ describe Hilbert do
27
27
  context 'into Ruby' do
28
28
  it do
29
29
  expect(
30
- Q.to_ruby.compile('(1 2 3)')
30
+ Hilbert.to_ruby.compile('(1 2 3)')
31
31
  ).to eq(
32
32
  'Vector[1, 2, 3]'
33
33
  )
@@ -37,7 +37,7 @@ describe Hilbert do
37
37
  context 'into Python' do
38
38
  it do
39
39
  expect(
40
- Q.to_python.compile('(1 2 3)')
40
+ Hilbert.to_python.compile('(1 2 3)')
41
41
  ).to eq(
42
42
  'array([1, 2, 3])'
43
43
  )
@@ -13,6 +13,9 @@ module Hilbert
13
13
  "temp_cal_f(#{var}) <= #{formula};
14
14
  temp_cal_f(#{close_to} + Float::EPSILON ** 20)"
15
15
  end
16
+ when :inter
17
+ Dydx::API.store_func(eval(var), eval(formula), :tmp)
18
+ Dydx::API.eval_func(eval(close_to) + Float::EPSILON ** 20, :tmp)
16
19
  else
17
20
  fail "List is not implemented for #{$meta_info.lang_str}"
18
21
  end
data/lib/hilbert/exec.rb CHANGED
@@ -32,7 +32,7 @@ module Hilbert
32
32
  when '-py'
33
33
  Hilbert.to_python
34
34
  else
35
- print 'Q support only Ruby and R now.'
35
+ print 'Hilbert support only Ruby and R now.'
36
36
  end
37
37
  end
38
38
 
@@ -40,7 +40,7 @@ module Hilbert
40
40
  file = open_file(file_path)
41
41
  input_string = read_file(file)
42
42
  file.close
43
- input_string.gsub(/(.*)I love mathematics\.(.*)Q\.E\.D(.*)/m) {
43
+ input_string.gsub(/(.*)I love mathematics\.(.*)Hilbert\.E\.D(.*)/m) {
44
44
  "#{$1}#{Kconv.tosjis(Hilbert.compile($2))}#{$3}"
45
45
  }
46
46
  end
data/lib/hilbert/iq.rb CHANGED
@@ -12,7 +12,7 @@ module Hilbert
12
12
  end
13
13
 
14
14
  def self.execute(code)
15
- ruby_code = Q.to_ruby.compile(code.encode('utf-8'))
15
+ ruby_code = Hilbert.to_ruby.compile(code.encode('utf-8'))
16
16
  ruby_obj = eval(ruby_code)
17
17
 
18
18
  optimize_output(ruby_obj).encode('utf-8')
@@ -14,6 +14,14 @@ module Hilbert
14
14
  @token_rule_hash ||= {}
15
15
  @token_rule_hash[pattern] = token.call
16
16
  end
17
+
18
+ def clear!
19
+ @token_rule_hash = {}
20
+ end
21
+
22
+ def execute(str)
23
+ new(str).lexeds
24
+ end
17
25
  end
18
26
 
19
27
  def initialize(str)
@@ -1,34 +1,44 @@
1
- #!/bin/env ruby
2
- # encoding: utf-8
3
-
4
1
  module Hilbert
5
2
  module Lexer
6
3
  class MainLexer < Base
7
- rule(/(#{FUNCCV})#{ANYSP}#{EQL}#{ANYSP}(#{FORMULA})/) { :def_func }
8
- rule(/#{ITGRLSYM}#{ANYSP}#{LPRN}(#{ANYSTR})#{RPRN}#{LBRCT}(#{ANYSTR})#{RBRCT}/) { :integral }
9
- rule(/d\/d(#{VAR}) (#{FORMULA})/) { :differential }
10
-
11
- rule(/lim#{LBRCT}(#{VAR})#{RSARW}(#{VARNUM})#{RBRCT} (#{FORMULA})/) { :limit }
12
-
13
- rule(/#{LPRN}(#{NUMS_BY_SP})#{RPRN}/) { :vector }
14
- rule(/#{LPRN}(#{NUMS_BY_SP_BY_SCLN_OR_NELN})#{RPRN}t/m) { :tmatrix }
15
- rule(/#{LPRN}(#{NUMS_BY_SP_BY_SCLN_OR_NELN})#{RPRN}/m) { :matrix }
16
-
17
- rule(/∑#{LBRCT}(#{VAR})=(#{INT}),#{ANYSP}(#{INT})#{RBRCT} (#{FORMULA})/) { :sigma }
18
- rule(/sigma#{LBRCT}(#{VAR})=(#{INT}),#{ANYSP}(#{INT})#{RBRCT} (#{FORMULA})/) { :sigma }
19
-
20
- rule(/#{FUNCCN}/) { :FUNCCN }
21
-
22
- rule(/#{LPRN}/) { :LPRN }
23
- rule(/#{RPRN}/) { :RPRN }
24
- rule(/#{LBRCS}/) { :LBRCS }
25
- rule(/#{RBRCS}/) { :RBRCS }
26
-
4
+ # TODO: So far so good, but...
5
+ rule(/postulate zfc_analysis/) { :POST_ZFC }
6
+ rule(/#{EVALOGIC}/) { :EVALOGIC }
7
+ rule(/#{DEFLOGIC}/) { :DEFLOGIC }
27
8
  rule(/[ \t\f]/)
28
9
 
29
10
  rule(/(\r|\n)+/) { :NULL }
30
11
 
31
12
  rule(/[^\(\)\{\}(\n\n)]+/) { :CONT }
13
+ class << self
14
+ include Tokens
15
+ def zfc_analysis!
16
+ clear!
17
+ rule(/postulate zfc_analysis/) { :POST_ZFC }
18
+ rule(/#{EVALOGIC}/) { :EVALOGIC }
19
+ rule(/#{DEFLOGIC}/) { :DEFLOGIC }
20
+ rule(/(#{FUNCCV})#{ANYSP}#{EQL}#{ANYSP}(#{FORMULA})/) { :DEF_FUNC }
21
+ rule(/#{INTE_SYM}#{ANYSP}#{LPRN}(#{ANYSTR})#{RPRN}#{LBRCT}(#{ANYSTR})#{RBRCT}/) { :INTEGRAL }
22
+ rule(/#{DIFF_SYM}(#{VAR}) (#{FORMULA})/) { :DIFFERENTIAL }
23
+ rule(/#{LIM_SYM}#{LBRCT}(#{VAR})#{RSARW}(#{VARNUM})#{RBRCT} (#{FORMULA})/) { :LIMIT }
24
+ rule(/#{SGM_SYM}#{LBRCT}(#{VAR})#{EQL}(#{INT})#{CMA}#{ANYSP}(#{INT})#{RBRCT} (#{FORMULA})/) { :SIGMA }
25
+
26
+ rule(/#{LPRN}(#{NUMS_BY_SP})#{RPRN}/) { :VECTOR }
27
+ rule(/#{LPRN}(#{NUMS_BY_SP_BY_SCLN_OR_NELN})#{RPRN}t/m) { :TMATRIX }
28
+ rule(/#{LPRN}(#{NUMS_BY_SP_BY_SCLN_OR_NELN})#{RPRN}/m) { :MATRIX }
29
+
30
+ rule(/#{FUNCCN}/) { :FUNCCN }
31
+ rule(/#{LPRN}/) { :LPRN }
32
+ rule(/#{RPRN}/) { :RPRN }
33
+ rule(/#{LBRCS}/) { :LBRCS }
34
+ rule(/#{RBRCS}/) { :RBRCS }
35
+ rule(/[ \t\f]/)
36
+
37
+ rule(/(\r|\n)+/) { :NULL }
38
+
39
+ rule(/[^\(\)\{\}(\n\n)]+/) { :CONT }
40
+ end
41
+ end
32
42
  end
33
43
  end
34
44
  end
@@ -1,3 +1,6 @@
1
+ #!/bin/env ruby
2
+ # encoding: utf-8
3
+
1
4
  module Hilbert
2
5
  module Lexer
3
6
  module Tokens
@@ -27,6 +30,12 @@ module Hilbert
27
30
  # # TERM
28
31
  # TERM = /(#{NUM}|#{VAR_MUL}|#{VAR_MUL})/
29
32
 
33
+ # SYM
34
+ LIM_SYM = /lim/
35
+ INTE_SYM = /S/
36
+ DIFF_SYM = /d\/d/
37
+ SGM_SYM = /(?:∑|sigma)/
38
+
30
39
  # OPE
31
40
  PLS = /\+/
32
41
  SUB = /-/
@@ -59,10 +68,21 @@ module Hilbert
59
68
  LSARW = '<-'
60
69
  RDARW = '=>'
61
70
  LDARW = '<='
62
- SP = / /
71
+ SPC = / /
72
+ SPCS = / +/
63
73
  NLIN = /(\r|\n)/
64
74
 
65
- ITGRLSYM = 'S'
75
+ # World
76
+ ## FIXIT
77
+ DEFLOGIC = /\A.*[A-RT-Z].*\z/
78
+ EVALOGIC = /\A.*[A-RT-Z].*\?\z/
79
+ PROVAR = /[A-RT-Z]/
80
+ CONJ = /\&/
81
+ DISJ = /\|/
82
+ NEGA = /\~/
83
+ COND = /\->/
84
+ BICO = /<\->/
85
+
66
86
  # FIXIT
67
87
  SCLN_OR_NELN = /(?:#{SCLN}|#{NLIN})/
68
88
 
@@ -80,7 +100,7 @@ module Hilbert
80
100
  NUMS_BY_CMA = Util.string_out(NUM, CMA)
81
101
  VARS_BY_CMA = Util.string_out(VAR, CMA)
82
102
  VARNUMS_BY_CMA = Util.string_out(VARNUM, CMA)
83
- NUMS_BY_SP = Util.string_out(NUM, SP)
103
+ NUMS_BY_SP = Util.string_out(NUM, SPC)
84
104
 
85
105
  FUNCCN = Util.func_call(NUMS_BY_CMA)
86
106
  FUNCCV = Util.func_call(VARS_BY_CMA)
@@ -0,0 +1,15 @@
1
+ module Hilbert
2
+ module Lexer
3
+ class WorldLexer < Base
4
+ rule(/#{PROVAR}/) { :PROVAR }
5
+ rule(/#{CONJ}/) { :CONJ }
6
+ rule(/#{DISJ}/) { :DISJ }
7
+ rule(/#{NEGA}/) { :NEGA }
8
+ rule(/#{COND}/) { :COND }
9
+ rule(/#{BICO}/) { :BICO }
10
+ rule(/#{LPRN}/) { :LPRN }
11
+ rule(/#{RPRN}/) { :RPRN }
12
+ rule(/#{SPCS}/) { :SPCS }
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,43 @@
1
+ module Hilbert
2
+ module Parser
3
+ class WorldParser
4
+ @@parsed_ary = []
5
+ @@stage
6
+ class << self
7
+ def execute(lexeds)
8
+ clear!
9
+
10
+ lexeds.each do |lexed|
11
+ parsed = case lexed[:token]
12
+ when :DISJ then ' + '
13
+ when :CONJ then ' * '
14
+ when :COND then ' >= '
15
+ when :BICO then ' <=> '
16
+ when :PROVAR then "$world.atom(:#{lexed[:value]})"
17
+ when :NEGA then " ~"
18
+ else lexed[:value]
19
+ end
20
+
21
+ push(parsed)
22
+ end
23
+ end
24
+
25
+ def push(parsed)
26
+ if parsed
27
+ @@parsed_ary << parsed
28
+ else
29
+ @@stage << lexed
30
+ end
31
+ end
32
+
33
+ def parsed_srt
34
+ @@parsed_ary.join
35
+ end
36
+
37
+ def clear!
38
+ @@parsed_ary = []
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -8,13 +8,16 @@ require 'hilbert/parser/func_parser'
8
8
  require 'hilbert/parser/integral_parser'
9
9
  require 'hilbert/parser/limit_parser'
10
10
  require 'hilbert/parser/sigma_parser'
11
+ require 'hilbert/parser/world_parser'
11
12
 
12
13
  require 'hilbert/parser/formula_parser'
14
+ require 'hilbert/lexer/world_lexer'
13
15
 
14
16
  module Hilbert
15
17
  module Parser
16
18
  include Lexer::Tokens
17
19
  SYM = '\w+'
20
+
18
21
  ONEHASH = "#{ANYSP}#{SYM}#{CLN}#{ANYSP}#{VARNUM}#{ANYSP}" # sdf: 234
19
22
  def execute(lexed)
20
23
  time = Time.now
@@ -22,18 +25,36 @@ module Hilbert
22
25
  fail "I'm so sorry, something wrong. Please feel free to report this." if Time.now > time + 10
23
26
 
24
27
  case lexed.token_str
25
- when /:(vector)(\d+)/, /:(matrix)(\d+)/, /:(tmatrix)(\d+)/, /:(integral)(\d+)/, /:(def_func)(\d+)/, /:(differential)(\d+)/, /:(limit)(\d+)/, /:(sigma)(\d+)/
28
+ when /:(POST_ZFC)(\d+)/
29
+ Hilbert::Lexer::MainLexer.zfc_analysis!
30
+ lexed.parsed!('', $2)
31
+ when /:(DEFLOGIC)(\d+)/
32
+ value = lexed.get_value($1)
33
+ lexeds = Lexer::WorldLexer.execute(value)
34
+ Parser::WorldParser.execute(lexeds)
35
+ $world << eval(Parser::WorldParser.parsed_srt)
36
+ rslt = %|"Defined: #{value} is TRUE"|
37
+ lexed.parsed!(rslt, $2)
38
+
39
+ when /:(EVALOGIC)(\d+)/
40
+ value = lexed.get_value($1).delete('?')
41
+ lexeds = Lexer::WorldLexer.execute(value)
42
+ Parser::WorldParser.execute(lexeds)
43
+ rslt = $world.impl eval(Parser::WorldParser.parsed_srt), value
44
+ lexed.parsed!(rslt, $2)
45
+
46
+ when /:(VECTOR)(\d+)/, /:(MATRIX)(\d+)/, /:(TMATRIX)(\d+)/, /:(INTEGRAL)(\d+)/, /:(DEF_FUNC)(\d+)/, /:(DIFFERENTIAL)(\d+)/, /:(LIMIT)(\d+)/, /:(SIGMA)(\d+)/
26
47
  token_els = lexed.get_els($2)
27
48
 
28
49
  parsed = case $1
29
- when 'vector' then VectorParser.execute(token_els)
30
- when 'matrix' then MatrixParser.execute(token_els)
31
- when 'tmatrix' then MatrixParser.execute(token_els, trans: true)
32
- when 'limit' then LimitParser.execute(token_els)
33
- when 'integral' then IntegralParser.execute(token_els)
34
- when 'def_func' then FuncParser.execute(token_els)
35
- when 'sigma' then SigmaParser.execute(token_els)
36
- when 'differential'
50
+ when 'VECTOR' then VectorParser.execute(token_els)
51
+ when 'MATRIX' then MatrixParser.execute(token_els)
52
+ when 'TMATRIX' then MatrixParser.execute(token_els, trans: true)
53
+ when 'LIMIT' then LimitParser.execute(token_els)
54
+ when 'INTEGRAL' then IntegralParser.execute(token_els)
55
+ when 'DEF_FUNC' then FuncParser.execute(token_els)
56
+ when 'SIGMA' then SigmaParser.execute(token_els)
57
+ when 'DIFFERENTIAL'
37
58
  del_var, formula = token_els
38
59
  "d/d#{del_var}(#{FormulaParser.execute(formula)})"
39
60
  end
@@ -1,3 +1,3 @@
1
1
  module Hilbert
2
- VERSION = '0.0.2700001'
2
+ VERSION = '0.0.2700100'
3
3
  end
@@ -0,0 +1,6 @@
1
+ module Hilbert
2
+ module World
3
+ class Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,174 @@
1
+ #!/bin/env ruby
2
+ # encoding: utf-8
3
+
4
+ module Hilbert
5
+ module World
6
+ module PropositionalLogic
7
+ module Operator
8
+ def ~@
9
+ if is_neg? then p
10
+ elsif is_form? then vars.map { |a|~a }.inject(reope)
11
+ else NEG.new(self)
12
+ end
13
+ end
14
+
15
+ def *(q)
16
+ case q
17
+ when Taut then self
18
+ when UTaut then $utout
19
+ when self then self
20
+ else
21
+ if neg?(q) then $utout
22
+ else FORM.new([self, q], :*)
23
+ end
24
+ end
25
+ end
26
+
27
+ def +(q)
28
+ case q
29
+ when Taut then $tout
30
+ when UTaut then self
31
+ when self then self
32
+ else
33
+ if neg?(q) then $tout
34
+ else FORM.new([self, q], :+)
35
+ end
36
+ end
37
+ end
38
+
39
+ def >=(q)
40
+ (~self + q)
41
+ end
42
+
43
+ def <=>(q)
44
+ (self >= q) * (q >= self)
45
+ end
46
+ end
47
+
48
+ module Utils
49
+ def neg?(p)
50
+ (is_a?(NEG) && self.p == p) ||
51
+ (p.is_a?(NEG) && p.p == self)
52
+ end
53
+
54
+ def is_neg?
55
+ is_a?(NEG)
56
+ end
57
+
58
+ def is_form?(ope=true)
59
+ return is_a?(FORM) if ope === true
60
+ is_a?(FORM) && @ope == ope
61
+ end
62
+
63
+ def is_or?
64
+ is_form?(:+)
65
+ end
66
+
67
+ def is_and?
68
+ is_form?(:*)
69
+ end
70
+
71
+ def include?(p)
72
+ false
73
+ end
74
+ end
75
+
76
+ module Base; include Operator; include Utils end
77
+
78
+ # Tautology
79
+ class Taut
80
+ include Base
81
+ def ~@; $utout end
82
+ def +(q); $tout end
83
+ def *(q); q end
84
+ def !@; $tout end
85
+ def to_s; 'TRUE' end
86
+ end
87
+ $tout = Taut.new
88
+
89
+ # Non Tautology
90
+ class UTaut
91
+ include Base
92
+ def ~@; $tout end
93
+ def +(q); q end
94
+ def *(q); $utout end
95
+ def !@; $utout end
96
+ def to_s; 'FALSE' end
97
+ end
98
+ $utout = UTaut.new
99
+
100
+ class Atom
101
+ include Base
102
+ attr_accessor :p
103
+ def initialize(p); @p = p end
104
+ def to_s; @p.to_s end
105
+ def !@; self end
106
+ def deep; 1 end
107
+ end
108
+ $atoms = []
109
+
110
+ class NEG
111
+ include Base
112
+ attr_accessor :p
113
+ def initialize(p); @p = p end
114
+ def to_s; "~#{@p}" end
115
+ def !@; ~(!p) end
116
+ def deep; p.deep+1 end
117
+ end
118
+
119
+
120
+ class FORM
121
+ include Base
122
+ attr_accessor :vars, :ope
123
+ def initialize(vars, ope)
124
+ vars = vars.map { |var| var.is_form?(ope) ? var.vars : var }.flatten
125
+ @vars, @ope = vars, ope
126
+ end
127
+
128
+ def include?(p)
129
+ vars.include?(p)
130
+ end
131
+
132
+ def to_s
133
+ str = vars.each.with_index.inject('(') do |str, (p, i)|
134
+ str = str + "#{p}#{i < vars.count-1 ? loope : ')'}"
135
+ str
136
+ end
137
+ end
138
+
139
+ def loope
140
+ @ope == :* ? '&' : '|'
141
+ end
142
+
143
+ def reope
144
+ is_and? ? :+ : :*
145
+ end
146
+
147
+ def are_there_neg?
148
+ pvars = vars.reject { |var| var.is_neg? }
149
+ nvars = vars.select { |var| var.is_neg? }
150
+ pvars.any? { |pvar|
151
+ nvars.any? { |nvar| nvar.neg?(pvar) }
152
+ }
153
+ end
154
+
155
+ def !@
156
+ if is_or?
157
+ if and_form = vars.find { |var| var.is_and? }
158
+ and_form.vars.map { |a| a + FORM.new((vars - [and_form]), :+) }.inject(:*)
159
+ elsif are_there_neg?
160
+ $tout
161
+ else
162
+ vars.map{|a|!a}.inject(@ope)
163
+ end
164
+ elsif is_and? && are_there_neg?
165
+ $utout
166
+ else
167
+ vars.map{|a|!a}.inject(@ope)
168
+ end
169
+ end
170
+ def deep; [p.deep, q.deep].max+1; end
171
+ end
172
+ end
173
+ end
174
+ end
@@ -0,0 +1,44 @@
1
+ require 'hilbert/world/base'
2
+ require 'hilbert/world/propositional_logic'
3
+
4
+ module Hilbert
5
+ module World
6
+ class Entity
7
+ @@propositions = []
8
+ class << self
9
+ def tautology
10
+ @@propositions
11
+ end
12
+
13
+ def <<(logic_form)
14
+ @@propositions << logic_form
15
+ end
16
+
17
+ def impl(logic_form, logic_str)
18
+ # HOTFIX:
19
+ return %|"Evaluate: #{logic_str} is UNDEFINED"| if @@propositions.empty?
20
+ str = (!!!!!!!(@@propositions.inject(:*) >= logic_form)).to_s
21
+ case str
22
+ when 'TRUE'
23
+ %|"Evaluate: #{logic_str} is TRUE"|
24
+ when 'FALSE'
25
+ %|"Evaluate: #{logic_str} is FALSE"|
26
+ else
27
+ %|"Evaluate: #{logic_str} is UNDEFINED"|
28
+ end
29
+ end
30
+
31
+ def atom(sym)
32
+ unless sym.to_s == sym.to_s.upcase && sym.to_s.length == 1
33
+ raise 'Proposltionla variable should be capital character'
34
+ end
35
+ eval "$#{sym} ||= PropositionalLogic::Atom.new(:#{sym})"
36
+ end
37
+
38
+ def clear!
39
+ @@propositions = []
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
data/lib/hilbert.rb CHANGED
@@ -5,17 +5,18 @@ require 'singleton'
5
5
  require 'yaml'
6
6
 
7
7
  $:.unshift(File.dirname(__FILE__))
8
- # Q core
8
+ # Hilbert core
9
9
  require 'hilbert/meta_info'
10
10
  require 'hilbert/utils/ruby_ext'
11
11
  require 'hilbert/lexer'
12
12
  require 'hilbert/parser'
13
+ require 'hilbert/world'
13
14
 
14
15
  module Hilbert
15
16
  $meta_info = MetaInfo.instance
17
+ $world = World::Entity
16
18
 
17
19
  class << self
18
-
19
20
  def compile(str)
20
21
  lexed = Lexer.execute(str)
21
22
  Kconv.tosjis(Parser.execute(lexed))
@@ -28,10 +29,6 @@ module Hilbert
28
29
  Hilbert
29
30
  end
30
31
  end
31
-
32
32
  end
33
33
 
34
34
  end
35
-
36
- # Make alias as Q
37
- Q = Hilbert
@@ -0,0 +1,54 @@
1
+ require 'minitest_helper'
2
+
3
+ class TestPropositionalLogic < TestInterpreterBase
4
+ def setup
5
+ $world.clear!
6
+ end
7
+
8
+ # TODO: opposite
9
+ def assert_iq_equal(output, input)
10
+ assert_equal(output, Hilbert::Iq.execute(input))
11
+ end
12
+
13
+ def test_general
14
+ assert_iq_equal('Defined: A is TRUE', 'A')
15
+ assert_iq_equal('Evaluate: A is TRUE', 'A?')
16
+ assert_iq_equal('Evaluate: B is UNDEFINED', 'B?')
17
+ assert_iq_equal('Defined: A->B is TRUE', "A->B")
18
+ assert_iq_equal('Evaluate: B is TRUE', 'B?')
19
+ end
20
+
21
+ def test_syllogisms
22
+ assert_iq_equal('Evaluate: A is UNDEFINED', 'A?')
23
+ assert_iq_equal('Evaluate: A -> C is UNDEFINED', 'A -> C ?')
24
+ assert_iq_equal('Defined: A -> B is TRUE', 'A -> B')
25
+ assert_iq_equal('Defined: B -> C is TRUE', 'B -> C')
26
+ assert_iq_equal('Evaluate: A -> C is TRUE', 'A -> C ?')
27
+ end
28
+
29
+ def test_paradox?
30
+ assert_iq_equal('Defined: A is TRUE', 'A')
31
+ assert_iq_equal('Defined: ~A is TRUE', '~A')
32
+ end
33
+ # assert_iq_equal('Defined: P(1) is true', "P(1)")
34
+ # assert_iq_equal('Evaluate: P(1) is true', 'P?(1)')
35
+ # assert_iq_equal('Evaluate: P(2) is undefined', 'P?(2)')
36
+ # assert_iq_equal('Evaluate: Q(1) is undefined', 'Q?(1)')
37
+ # assert_equal(
38
+ # "Defined: A[x] P(x) -> A[x] Q(x) is true",
39
+ # $world.truth.def_impli(['P', :all, true], ['Q', :all, true])
40
+ # )
41
+ # assert_iq_equal('Evaluate: Q(1) is true', 'Q?(1)')
42
+ #
43
+ # assert_iq_equal('Evaluate: Q(2) is undefined', 'Q?(2)')
44
+ #
45
+ # $world.truth.reset!
46
+ # assert_iq_equal("Defined: Human('gogo1') is true", "Human('gogo1')")
47
+ # assert_equal(
48
+ # "\"Defined: Human(\\'gogo1\\') -> WillDie(\\'gogo1\\') is true\"",
49
+ # $world.truth.def_impli(['Human', 'gogo1', true], ['WillDie', 'gogo1', true])
50
+ # )
51
+ # assert_iq_equal("Evaluate: WillDie('gogo1') is true", "WillDie?('gogo1')")
52
+ # assert_iq_equal("Evaluate: WillDie('gogo2') is undefined", "WillDie?('gogo2')")
53
+ # assert_iq_equal('Evaluate: Q(x) is true', 'Q?(x)')
54
+ end
data/test/langs/test_r.rb CHANGED
@@ -5,7 +5,7 @@ class TestR < TestInterpreterBase
5
5
  end
6
6
 
7
7
  def assert_r_compl_eq(output, input)
8
- assert_equal(output, Q.to_r.compile(input))
8
+ assert_equal(output, Hilbert.to_r.compile(input))
9
9
  end
10
10
 
11
11
  def test_function
@@ -1,3 +1,6 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+
1
4
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
5
  require 'hilbert'
3
6
 
@@ -6,3 +9,4 @@ require 'pp'
6
9
  require 'pry'
7
10
 
8
11
  require 'interpreter/base'
12
+ Hilbert::Iq.execute('postulate zfc_analysis')
@@ -1,13 +1,13 @@
1
1
  require 'minitest_helper'
2
2
  # require 'hilbert/hilbert'
3
3
 
4
- class TestQMatrix < TestInterpreterBase
4
+ class TestHilbertMatrix < TestInterpreterBase
5
5
  def setup
6
6
  end
7
7
 
8
8
  def test_main
9
- # assert_equal(50.0, QMatrix.new.func(10))
9
+ # assert_equal(50.0, HilbertMatrix.new.func(10))
10
10
 
11
- # assert_equal(8.0, QMatrix.new.execute(0, 2, 100))
11
+ # assert_equal(8.0, HilbertMatrix.new.execute(0, 2, 100))
12
12
  end
13
13
  end
@@ -5,12 +5,11 @@ class TestHilbert < MiniTest::Unit::TestCase
5
5
  end
6
6
 
7
7
  def assert_to_ruby(input, output)
8
- assert_equal(Q.to_ruby.compile(input), output)
8
+ assert_equal(Hilbert.to_ruby.compile(input), output)
9
9
  end
10
10
 
11
11
  def test_basis
12
12
  refute_nil ::Hilbert::VERSION
13
- assert_equal(Hilbert, Q)
14
13
  end
15
14
 
16
15
  def test_demo_code
@@ -21,4 +20,3 @@ class TestHilbert < MiniTest::Unit::TestCase
21
20
  assert_equal(Vector[1, 2, 3].to_q, '(1 2 3)')
22
21
  end
23
22
  end
24
-
@@ -0,0 +1,21 @@
1
+ require 'minitest_helper'
2
+
3
+ class TestLexer < MiniTest::Unit::TestCase
4
+ def test_general
5
+ lexeds = Hilbert::Lexer::WorldLexer.execute('(A -> B) <-> (C|D)&(E&~R)')
6
+ assert_equal(22, lexeds.count)
7
+ Hilbert::Parser::WorldParser.execute(lexeds)
8
+ assert_equal(
9
+ "($world.atom(:A) >= $world.atom(:B)) <=> ($world.atom(:C) + $world.atom(:D)) * ($world.atom(:E) * ~$world.atom(:R))",
10
+ Hilbert::Parser::WorldParser.parsed_srt
11
+ )
12
+
13
+
14
+ lexeds = Hilbert::Lexer::WorldLexer.execute('(A & (A -> B)) -> B')
15
+ Hilbert::Parser::WorldParser.execute(lexeds)
16
+ assert_equal(
17
+ "($world.atom(:A) * ($world.atom(:A) >= $world.atom(:B))) >= $world.atom(:B)",
18
+ Hilbert::Parser::WorldParser.parsed_srt
19
+ )
20
+ end
21
+ end
@@ -0,0 +1,67 @@
1
+ class TestPropLogic < MiniTest::Unit::TestCase
2
+ # Fixit:
3
+ $p = $world.atom(:P)
4
+ $q = $world.atom(:Q)
5
+ $r = $world.atom(:R)
6
+ def setup
7
+
8
+ end
9
+ def assert_to_s(exp, obj)
10
+ assert_equal(exp, ((!!!!!!!obj).to_s))
11
+ end
12
+
13
+ def test_utils
14
+ assert_equal(true, $p.neg?(~$p))
15
+ assert_equal(true, (~$p).neg?($p))
16
+ assert_equal(false, ($p).neg?($p))
17
+ assert_equal(false, ($p).neg?($p))
18
+ assert_equal(true, ($p + $q).include?($p))
19
+ assert_equal(true, ($p + $q).include?($q))
20
+ end
21
+
22
+ def test_0_1
23
+ assert_to_s("TRUE", $p + $tout)
24
+ assert_to_s("TRUE", $tout + $p)
25
+ assert_to_s("P", $p + $utout)
26
+ assert_to_s("P", $utout + $p)
27
+ assert_to_s("TRUE", $p + ~$p)
28
+ assert_to_s("TRUE", ~$p + $p)
29
+
30
+ assert_to_s("P", $p * $tout)
31
+ assert_to_s("P", $tout * $p)
32
+ assert_to_s("FALSE", $p * $utout)
33
+ assert_to_s("FALSE", $utout * $p)
34
+ assert_to_s("FALSE", $p * ~$p)
35
+ assert_to_s("FALSE", ~$p * $p)
36
+ end
37
+
38
+ def test_basis
39
+ assert_to_s("P", $p)
40
+ assert_to_s("(P|Q)", $p + $q)
41
+ assert_to_s("(P&Q)", $p * $q)
42
+ assert_to_s("~P", ~$p)
43
+ assert_to_s("(~P|Q)", $p >= $q)
44
+ assert_to_s("((~P|Q)&(~Q|P))", $p <=> $q)
45
+ end
46
+
47
+ def test_main
48
+ assert_to_s("(~P&~Q)", ~($p + $q))
49
+ assert_to_s("(~P|~Q)", ~($p * $q))
50
+ assert_to_s("P", ~(~$p))
51
+ assert_to_s("((Q|P)&(R|P))", $p + ($q * $r))
52
+ assert_to_s("(P&Q&R)", $p * ($q * $r))
53
+ assert_to_s("(P&(~P|Q))", $p * ($p >= $q))
54
+ end
55
+
56
+ def test_tautology
57
+ assert_to_s("TRUE", ~(~$p) >= $p)
58
+ assert_to_s("TRUE", ($p * ($p >= $q)) >= $q)
59
+ assert_to_s("TRUE", (($p >= $q) * ($q >= $r)) >= ($p >= $r))
60
+ assert_to_s("TRUE", (~$p * ($p + $q)) >= ($q))
61
+ assert_to_s("TRUE", (($p >= $q) * ($q >= $r) * $p) >= ($r))
62
+ end
63
+
64
+ def test_no_tautology
65
+ assert_to_s("FALSE", $p * $q * ~$p)
66
+ end
67
+ end
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hilbert
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2700001
4
+ version: 0.0.2700100
5
5
  platform: ruby
6
6
  authors:
7
7
  - gogotanaka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-06 00:00:00.000000000 Z
11
+ date: 2014-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dydx
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.1.41421
19
+ version: 0.2.7000000
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.1.41421
26
+ version: 0.2.7000000
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake-compiler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: minitest
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  description: Enjoy MATH!
@@ -89,10 +89,10 @@ extensions:
89
89
  - ext/hilbert/extconf.rb
90
90
  extra_rdoc_files: []
91
91
  files:
92
- - .coveralls.yml
93
- - .gitignore
94
- - .rubocop.yml
95
- - .travis.yml
92
+ - ".coveralls.yml"
93
+ - ".gitignore"
94
+ - ".rubocop.yml"
95
+ - ".travis.yml"
96
96
  - Gemfile
97
97
  - Guardfile
98
98
  - LICENSE.txt
@@ -132,6 +132,7 @@ files:
132
132
  - lib/hilbert/lexer/formula_lexer.rb
133
133
  - lib/hilbert/lexer/main_lexer.rb
134
134
  - lib/hilbert/lexer/tokens.rb
135
+ - lib/hilbert/lexer/world_lexer.rb
135
136
  - lib/hilbert/meta_info.rb
136
137
  - lib/hilbert/parser.rb
137
138
  - lib/hilbert/parser/base.rb
@@ -143,9 +144,13 @@ files:
143
144
  - lib/hilbert/parser/matrix_parser.rb
144
145
  - lib/hilbert/parser/sigma_parser.rb
145
146
  - lib/hilbert/parser/vector_parser.rb
147
+ - lib/hilbert/parser/world_parser.rb
146
148
  - lib/hilbert/utils/langs.yml
147
149
  - lib/hilbert/utils/ruby_ext.rb
148
150
  - lib/hilbert/version.rb
151
+ - lib/hilbert/world.rb
152
+ - lib/hilbert/world/base.rb
153
+ - lib/hilbert/world/propositional_logic.rb
149
154
  - test/internal/test_tokens.rb
150
155
  - test/interpreter/base.rb
151
156
  - test/interpreter/test_differential.rb
@@ -154,13 +159,16 @@ files:
154
159
  - test/interpreter/test_integral.rb
155
160
  - test/interpreter/test_limit.rb
156
161
  - test/interpreter/test_matrix.rb
162
+ - test/interpreter/test_propositional_logic.rb
157
163
  - test/interpreter/test_sigma.rb
158
164
  - test/interpreter/test_vector.rb
159
165
  - test/langs/test_r.rb
160
166
  - test/langs/test_ruby.rb
161
167
  - test/minitest_helper.rb
162
168
  - test/q_matrix/test_q_matrix.rb
163
- - test/test_qlang.rb
169
+ - test/test_hilbert.rb
170
+ - test/world/test_lexer.rb
171
+ - test/world/test_prop_logic.rb
164
172
  homepage: http://q-language.org/
165
173
  licenses:
166
174
  - MIT
@@ -171,17 +179,17 @@ require_paths:
171
179
  - lib
172
180
  required_ruby_version: !ruby/object:Gem::Requirement
173
181
  requirements:
174
- - - '>='
182
+ - - ">="
175
183
  - !ruby/object:Gem::Version
176
184
  version: '0'
177
185
  required_rubygems_version: !ruby/object:Gem::Requirement
178
186
  requirements:
179
- - - '>='
187
+ - - ">="
180
188
  - !ruby/object:Gem::Version
181
189
  version: '0'
182
190
  requirements: []
183
191
  rubyforge_project:
184
- rubygems_version: 2.0.2
192
+ rubygems_version: 2.2.2
185
193
  signing_key:
186
194
  specification_version: 4
187
195
  summary: Enjoy MATH!
@@ -194,10 +202,13 @@ test_files:
194
202
  - test/interpreter/test_integral.rb
195
203
  - test/interpreter/test_limit.rb
196
204
  - test/interpreter/test_matrix.rb
205
+ - test/interpreter/test_propositional_logic.rb
197
206
  - test/interpreter/test_sigma.rb
198
207
  - test/interpreter/test_vector.rb
199
208
  - test/langs/test_r.rb
200
209
  - test/langs/test_ruby.rb
201
210
  - test/minitest_helper.rb
202
211
  - test/q_matrix/test_q_matrix.rb
203
- - test/test_qlang.rb
212
+ - test/test_hilbert.rb
213
+ - test/world/test_lexer.rb
214
+ - test/world/test_prop_logic.rb