From 3cecf4f2e2b6de8c9fc09f78b891ea53206a5f86 Mon Sep 17 00:00:00 2001 From: Plinio Balduino Date: Sat, 30 Jul 2011 00:29:54 -0300 Subject: [PATCH 1/4] . --- misc/lucio.png | Bin 0 -> 2763 bytes misc/lucio.svg | 110 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 misc/lucio.png create mode 100644 misc/lucio.svg diff --git a/misc/lucio.png b/misc/lucio.png new file mode 100644 index 0000000000000000000000000000000000000000..1d7f367460baf9556ac27aaf2ad0cbd096277300 GIT binary patch literal 2763 zcmZuzc|6oxAD)DUD~*~YT%oaC#*#a6NtVfEhK9&Q*%`}R%UEWph$KXdB4im;ipi9% zv4_EsS91#uW-OUxyHS=VNyvNp@BQQbeLmmc`TUl1&i6du=XuUaKkZ<X0)gzt zVQrj2O9Y_>l?3;7{m;3e5syaWT%h2JhZ3)YXQ>G6xo8MP!r)izI3Ga?1TPO#Fm9AH zPWvQr{qYt=R0;!taAYmpgMnk~#k za`DcKJ0A|`Hf0_?+F*j&b^@>b6s$tdNLk8 z+Q~6=^Yqln;~qJBwEN+Sv|tj+I_q(dnbb^FzI~p4O-suuTiabF+Ugm%YG}hLusm)` z&yB|IE+pEG#T2n_qy@`_=@l)AK`5Th=Dxz`QAoi{azpv7BqX0)yYIVRr%! zR`Ko4Rp#pWUMFDUr+B}9eas_ebo*71H`)#H`!aiy--Y)~MpRc{`2TyctiB&_sGD&K*8wfhnKgM z%vZYh1s9|uaI4K*iK79m5rA3ayKoz)#}yS}d=3o*XeLZNsix-0!gnwlC`rc7U9u0D^KHpZ^dBP!ja8nfbfmlt0wo!4>7LfmMqt2>&}t?r$$uHo&of)X(AfB-QT}xQ!xQ4k)}h8@l|x|) zlKe`~!*{XOwYAqO7ruV`76sO;I|!GS(D!b;sR}h;8;{n`xQf8#2D$VuUuso0jk;D} zZ;Zn4eBW~@kr)$`%ijK3I63L-mAJK9FzZIu=tAN3y;`6?VV}DF?yjsvU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kOw-gZ#GTYZ)Uj4IpFLXF-xwQ>O% zMs01aD%WTr_}&~nQKkJ=?bG#>O&+tNKFc5q_P_ceGeX1oaiq zeCWP0ExMSRmbU(t=O`!MA)Qj9{r25Eyt#_j-t_*72`?6!^jhUKVZo}&Ll(~i3V*<0 z1PKdrRH2O?`r#8Tq+TvC(U1_`=g8>q%f6?02$}<{x!F!92b~*$ehAZYD0;wRWfvD0 zd-mQh(Uy^s0jpF}QUX>bf8fAfgcMsyz8FCLQt8dUjpTMsMRrbB*YywrE`dsMxm;i@ zG8{;~Nd(~CrLWp67mC0(&0Rb%=gbP4FCzgG-lx$t@=uj8byhAYXZHA)Gih^*sU4l2 zVmu!2dI=UO&&r?x?+3e8RxhI5B_q^0Bw#bVp|G-2AAsY);7O+pnT^nn#kzTT)OMa~ z@~F4_1Uw#mhGTrG)Er>U2wX{3RUh-;&KTS;m6n!jfS~~V06CvyXUHKThhfnEk&$%n z43i|)R%T!dvIb&LLGQq2JyT%QYjW%)IEK&WcFU&iBoO2<1I%+XqKnT*kllWAJQToy zK+q$_H4LKgzyZ(}bgewDuYx4#cYefr03n=7C#kw52IFEMVa)CxB|W2?T!jjU~tE>{CR + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + λuciο + + From 700e0dffe628fcbabdf57ca41c0e014d0dbfde07 Mon Sep 17 00:00:00 2001 From: pbalduino Date: Wed, 3 Aug 2011 16:00:30 -0300 Subject: [PATCH 2/4] Fixed some issues with macros --- lib/lucio/lucio.rb | 2 +- lib/lucio/macro.rb | 20 ++++++-------------- spec/macro_spec.rb | 8 ++++---- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/lib/lucio/lucio.rb b/lib/lucio/lucio.rb index c5aa393..702b128 100644 --- a/lib/lucio/lucio.rb +++ b/lib/lucio/lucio.rb @@ -38,7 +38,7 @@ def initialize(lexicon = LexiconStack.new) @lexicon.add_macro :define , lambda{|lexicon, items| define lexicon, items } @lexicon.add_macro :if , lambda{|lexicon, items| Evaluator.evaluate_tree(items[0], lexicon) ? Evaluator.evaluate_tree(items[1], lexicon) : (Evaluator.evaluate_tree(items[2], lexicon) if items[2]) } @lexicon.add_macro :fun , lambda{|lexicon, items| lexicon.add_function items.to_sym, Function.new(items, lexicon) } - @lexicon.add_macro :defmacro , lambda{|lexicon, items| h, t = Lucio.behead(items); lexicon.add_macro h, Macro.new(t, lexicon) } + @lexicon.add_macro :defmacro , lambda{|lexicon, items| h, t = Lucio.behead(items); lexicon.add_macro h, Macro.new(t) } @lexicon.add_macro :send , lambda{|lexicon, items| items[1].send(items[0], items[2]) } # eval('(include "lib/core")') diff --git a/lib/lucio/macro.rb b/lib/lucio/macro.rb index 2b77c5e..6961fed 100644 --- a/lib/lucio/macro.rb +++ b/lib/lucio/macro.rb @@ -1,5 +1,5 @@ class Macro - def initialize(declaration, lexicon) + def initialize(declaration) @signatures = {} declaration.each do |signature| @@ -20,32 +20,24 @@ def initialize(declaration, lexicon) end end - def call(global_lexicon, list) + def call(lexicon, list) signature = @signatures[list.size] parameters = signature[:parameters] + code = Array.new(signature[:code][0]) - result = replace(list, parameters, Array.new(signature[:code][0])) + replaced = replace(list, parameters, code) - p 'call', result - - result + Evaluator.evaluate_tree replaced, lexicon end def replace(list, parameters, result) - puts '' - p 'b4', result list.size.times do |item| result.map! do |part| - if part.is_array? - part = replace(list, parameters, part) - else - part == parameters[item] ? list[item] : part - end + part = part == parameters[item] ? list[item] : part end end - p 'aftr', result result end end diff --git a/spec/macro_spec.rb b/spec/macro_spec.rb index fed4a60..6a57438 100644 --- a/spec/macro_spec.rb +++ b/spec/macro_spec.rb @@ -5,7 +5,7 @@ before :each do @lucio = Lucio.new end -=begin + it 'simple if implementation' do macro = ' (defmacro my-if @@ -21,7 +21,7 @@ (my-if (eql? 1 2) (true) (false))' - + @lucio.eval(macro + code_true).should be_true @lucio.eval(macro + code_false).should be_false @@ -46,7 +46,7 @@ it 'simple if implementation with variable = false' do code = <<-LISP (defmacro my-if - ([test? x truey x falsey x] + ([test? then truey else falsey end] `(display test?)(if test? truey falsey))) (define x false) @@ -64,7 +64,7 @@ @lucio.eval(code).should be_false end -=end + end end From e15a13ea3317d129a0fada83b2f0120797f381a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pl=C3=ADnio?= Date: Wed, 17 Aug 2011 08:16:21 -0300 Subject: [PATCH 3/4] Added build status --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bd93e8a..bce0907 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Lucio (en) +# Lucio (en) ## What? Lucio is **intended to be** a Lisp-like language developed in Ruby only for knowledge and fun. No profit intended. From 865df43e869079dc89bf82660b495956b6c392e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pl=C3=ADnio?= Date: Wed, 17 Aug 2011 12:21:14 -0300 Subject: [PATCH 4/4] Fixed build status and added greetings --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bce0907..d81b12e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Lucio (en) +# Lucio (en) ## What? Lucio is **intended to be** a Lisp-like language developed in Ruby only for knowledge and fun. No profit intended. @@ -89,3 +89,5 @@ A lista de colaboradores está no final desse arquivo e, espero que continue cre * Bruno Jessen * Santiago Nunes + + Douglas Campos (/qmx) [@qmx](http://twitter.com/qmx) \ No newline at end of file