crokus 0.0.4 → 0.0.5
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 +4 -4
- data/lib/crokus/compiler.rb +4 -36
- data/lib/crokus/version.rb +1 -1
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e5122ba3ad8a0b8cdecf4f0cf72adfa520f8e7553204757d0e91170419e8a08
|
4
|
+
data.tar.gz: 58c00c66d56d5a9866a397cfb1386586f4020918d1ec509e5faa8c16afa2422c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34dc9b951b86aad23353e704c19c9c7c0a191a66a5f362f6350d7e4c82cba9ae904f632d55cdfd889ff407509e911979426984820c76df9954657914168764a4
|
7
|
+
data.tar.gz: 3e5a136ac1cd79905900b9fe34ccc945d7cdee8841594441f194d447c54600e20086b1751c90911eead1c29b248980b81a710af67073a4ef97d2c89a303ab87e
|
data/lib/crokus/compiler.rb
CHANGED
@@ -7,14 +7,11 @@ require_relative 'pretty_printer'
|
|
7
7
|
require_relative 'cfg_builder'
|
8
8
|
require_relative 'tac_builder'
|
9
9
|
require_relative 'ir_dumper'
|
10
|
-
|
11
|
-
# random C generation
|
12
|
-
require_relative 'cfg_random_gen'
|
10
|
+
require_relative 'cfg_random_gen' # random C generation
|
13
11
|
|
14
12
|
module Crokus
|
15
13
|
|
16
14
|
class Compiler
|
17
|
-
|
18
15
|
attr_accessor :options
|
19
16
|
attr_accessor :parser
|
20
17
|
attr_accessor :ast
|
@@ -26,34 +23,20 @@ module Crokus
|
|
26
23
|
@parser=Parser.new
|
27
24
|
end
|
28
25
|
|
29
|
-
def header
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
26
|
def compile filename
|
34
|
-
header
|
35
|
-
|
36
27
|
parse(filename)
|
37
|
-
if options[:parse_only]
|
38
|
-
return true
|
39
|
-
end
|
28
|
+
return true if options[:parse_only]
|
40
29
|
|
41
30
|
build_cfg
|
42
|
-
if options[:cfg]
|
43
|
-
return true
|
44
|
-
end
|
31
|
+
return true if options[:cfg]
|
45
32
|
|
46
33
|
build_tac
|
47
|
-
if options[:tac]
|
48
|
-
return true
|
49
|
-
end
|
34
|
+
return true if options[:tac]
|
50
35
|
|
51
36
|
emit_ir
|
52
37
|
return true
|
53
38
|
end
|
54
39
|
|
55
|
-
|
56
|
-
|
57
40
|
def parse filename
|
58
41
|
@base_name=File.basename(filename, ".c")
|
59
42
|
code=IO.read(filename)
|
@@ -63,12 +46,6 @@ module Crokus
|
|
63
46
|
pretty_print if options[:pp]
|
64
47
|
end
|
65
48
|
|
66
|
-
# def parse filename
|
67
|
-
# @base_name=File.basename(filename, ".c")
|
68
|
-
# code=IO.read(filename)
|
69
|
-
# @ast=Parser.new.parse(code)
|
70
|
-
# end
|
71
|
-
|
72
49
|
def draw_ast tree=nil,filename=nil
|
73
50
|
dotname=filename || "#{base_name}.dot"
|
74
51
|
puts " |--> drawing AST '#{dotname}'" unless options[:mute]
|
@@ -117,14 +94,5 @@ module Crokus
|
|
117
94
|
def execute params
|
118
95
|
RandomGen.new.run(params)
|
119
96
|
end
|
120
|
-
|
121
97
|
end
|
122
98
|
end
|
123
|
-
#
|
124
|
-
# if $PROGRAM_NAME == __FILE__
|
125
|
-
# filename=ARGV[0]
|
126
|
-
# t1 = Time.now
|
127
|
-
# C::Compiler.new.compile(filename)
|
128
|
-
# t2 = Time.now
|
129
|
-
# puts "parsed in : #{t2-t1} s"
|
130
|
-
# end
|
data/lib/crokus/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crokus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean-Christophe Le Lann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: distribution
|
@@ -38,9 +38,8 @@ dependencies:
|
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.8.1
|
41
|
-
description: Crokus is
|
42
|
-
|
43
|
-
System Level experiments.
|
41
|
+
description: Crokus is a parser for a subset of C language. It has been use for teaching
|
42
|
+
purposes and applied to Electronic System Level experiments.
|
44
43
|
email: lelannje@ensta-bretagne.fr
|
45
44
|
executables:
|
46
45
|
- crokus
|
@@ -96,5 +95,5 @@ rubyforge_project:
|
|
96
95
|
rubygems_version: 2.7.7
|
97
96
|
signing_key:
|
98
97
|
specification_version: 4
|
99
|
-
summary: Simple parser for a
|
98
|
+
summary: Simple parser for a subset of C language, for experimental purposes
|
100
99
|
test_files: []
|