summaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2025-04-26 23:14:38 +0200
committerEugen Wissner <belka@caraus.de>2025-04-26 23:14:38 +0200
commita60e623af5eff3b0252cf6100cf0c366a9d3058b (patch)
tree0a0e134923d0a8380949536f52535109fab051f7 /Rakefile
parentfee1781a5bb097b28056a43138713095dfa47a4a (diff)
downloadelna-a60e623af5eff3b0252cf6100cf0c366a9d3058b.tar.gz
Implement simple binary expressions
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile32
1 files changed, 32 insertions, 0 deletions
diff --git a/Rakefile b/Rakefile
index 5976113..e04bff1 100644
--- a/Rakefile
+++ b/Rakefile
@@ -63,3 +63,35 @@ end
file 'build/stage2b' => ['build/stage2b.s', 'boot/common-boot.s'] do |t|
sh CROSS_GCC, '-nostdlib', '-o', t.name, *t.prerequisites
end
+
+desc 'Print remaining lines to rewrite'
+task :statistics do
+ def is_false_positive(word)
+ word.start_with?('(*') ||
+ word.start_with?('*)') ||
+ ('A'..'Z').include?(word[0]) ||
+ /^[[:alpha:]][[:digit:]]$/.match(word)
+ end
+
+ lines = File.read('boot/stage2.elna')
+ .split("\n")
+ .select { |line| line.start_with? "\t" }
+ .map { |line| line.delete_prefix("\t").split(' ') }
+ .reject { |words| is_false_positive(words.first) }
+ .group_by do |words|
+ if words.first.length < 5
+ case words.first
+ when 'goto'
+ 'Statements'
+ else
+ words.first
+ end
+ else
+ 'Statements'
+ end
+ end
+
+ lines.each do |key, value|
+ puts "#{key}: #{value.count}"
+ end
+end