Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Lisp bytecode compiler

Name: Anonymous 2012-06-22 19:25

Am I missing any special forms?
lambda if setq let quote

I know let isn't really needed because it can be implemented in terms of lambda, but recognizing ((lambda ...) ...) sounds more confusing than just using let.

Name: Anonymous 2012-06-22 20:24

lambda if set!/setq let labels/letrec quoteflet defun progn/begin defvar/define

The ones in italic are for Lisp-2s.

Name: Anonymous 2012-06-22 21:09

>>2
Why labels/letrec?  I figured I could just implement it as a macro in terms of setq and let.

Also I forgot to put progn/begin in my list; I actually chose the shorter name do for it, although I'm not sure whether it's a good idea (progn, for instance, has the advantage of allowing prog1 and prog2 to exist by extension, but I'm not sure about how useful that is in practise).

Name: Anonymous 2012-06-22 21:32

>>3
Same reason for having let instead of desugaring it to lambda, it might easier to deal with, but it depends on what kind of optimizations your compiler is going to do.

begin0/prog1 is really useful, (prog2 a b c ...) can (supposedly?) be implemented as (prog1 (progn a b) c ...).

Also, in absence of proper tail calls, you need something like tagbody.

Name: Anonymous 2012-06-22 21:49

Bytecode? Make a Lisp FPGA!

Name: Anonymous 2012-06-22 22:36

>>5
FPGA
Good luck synthesizing your netlist to bitstream using non-closed source tools.  you can't

Name: Anonymous 2012-06-22 22:47

i bet javascript would be much simpler

Name: Anonymous 2012-06-22 23:17

As long as CPUs only have a single data buss where instructions and memory locations can only be accessed on at a time, then I dont see how there could be any advantage in interpreting high level language instructions will achieve anything

Name: Anonymous 2012-06-22 23:38

>>8
JIT compilation.  Look it up.

Name: Anonymous 2012-06-22 23:53

>>8
I know what JIT is and it has nothing to do with hardware interpretation of high level languages

Name: Anonymous 2012-06-23 0:54

>>8
That's why OP should use an FPGA and make several buses like the Reduceron does.

Name: Anonymous 2012-06-23 0:59

>>11
I want to prove that efficient Lisp is possible regardless of the host architecture.  Doing efficient Lisp on a machine designed for it doesn't sound like something to be proud of.

Name: Anonymous 2012-06-23 1:19

>>12
A LISP program is just a program, and any chunk of machine code that represents a program equivalent to the LISP program can be a potential output of the compiler. One method could be to take a regular lisp interpreter, iterate through all bit sequences, run the bit sequence against all possible inputs to the program, and compare the output to the LISP program running in a slow interpreter. Keep the binary sequences that scores the highest in terms of some desired combination of memory usage, speed, and code size. And there you go. An optimal LISP compiler. The only draw back that there might be is maybe LISP as a language is just too expressive, and any trivial LISP program ends up being able to elegantly handle too many inputs, and forces the compiler to handle more meaningful input cases and decrease overall efficiency.

Name: Anonymous 2012-06-23 5:08

>>13
One method could be to take a regular lisp interpreter, iterate through all bit sequences, run the bit sequence against all possible inputs to the program, and compare the output to the LISP program running in a slow interpreter. Keep the binary sequences that scores the highest in terms of some desired combination of memory usage, speed, and code size.
Are you insane?

Name: Anonymous 2012-06-23 6:07

>>14
Hes just SICP

Name: Anonymous 2012-06-23 6:17

>>15
I didn't get that far in SICP but I doubt the Suss would endorse such a retarded method.  I'm not sure I even understand what >>13 is saiyan!

Name: Anonymous 2012-06-23 7:53

>>12
Even C is efficient because today's architectures are designed to run C code as fast as possible, and because of pretty damn good compilers.

>>13
One method could be to take a regular lisp interpreter, iterate through all bit sequences, run the bit sequence against all possible inputs to the program, and compare the output to the LISP program running in a slow interpreter.
Halting problem.

Name: Anonymous 2012-06-23 15:26

>>17
All >>13 would have to do is solve the halting problem.  He already thinks it a trivial thing, so let's just let him use whatever method he wants.

Name: Anonymous 2012-06-23 15:39

>>17
It's ok as long as the lisp program always happens to terminate within a reasonable amount of time. This wont work if the lisp program has an infinite loop in it of course. It is unfortunate that this cannot be determined in advance, as it will cripple the compilation process, but it's ok. When running a binary sequence, its execution can be terminated if it reaches a certain timeout, which can be determined using the parameters of the score method. There would be a problem if every candidate exhausted the time out, but in that case, all you have to do is double the time out and run them all again. If at least one of them terminates within a finite amount of time on all inputs, it will be found eventually, and it wouldn't take many trials to rule out ones that take so much longer that they could never obtain a comparable score.

>>18
No, I don't think I can solve the halting problem. It can be solved for a variety of classes of programs, but to do it for all would lead to a contradiction. I am merely enumerating through all possible 2^N programs that can exist in N bits of memory, and running them on all possible 2^M inputs, that can exist in M bits of memory. It's quite simple you know.

Name: Anonymous 2012-06-23 15:40

>>17-18
Thought so.

Name: Anonymous 2012-06-23 15:58

>>19
length [0..]
Pretty damn short.

Name: Anonymous 2012-06-23 16:08

>>21
yes, that could be an optimal output for a program that infinitely loops. But I think the following has shorter code size:


loop: jmp loop


And hence this representation would be chosen instead.

Name: Anonymous 2012-06-23 16:46

>>22
For me, it would be loop: j loop because I'll be using a YeeLong-8133.

Name: Anonymous 2012-06-23 18:50

>>17
Even C is efficient because today's architectures are designed to run C code as fast as possible
people here are talking out of their ass. the only language the cpu supports is its machine language. making a cpu specific to a certain high level language would cripple its use a general purpose cpu

Name: Anonymous 2012-06-23 19:56

>>24
What you say is technically true, but think about this for a second:
Would a new architecture be successful, if C code doesn't map closely enough to its ISET?
Case in point: Itanium.

Name: Anonymous 2012-06-23 22:14

>>24
this

Name: Anonymous 2012-06-23 23:22

>>23
When will you?

Name: Anonymous 2012-06-24 1:25

>>17
HURR DURR if processors are designed for C, then why is FORTRAN faster than C?

Name: Anonymous 2012-06-24 4:55

>>28
Because it is awezome

Name: Anonymous 2012-06-24 6:24

>>25
this is our chance weenies! We have to make a haskal compiler that out performs C on the itanium!

Name: Anonymous 2012-06-24 11:53

Yes, quite a few. Check Hyperspec for CL and RnRS for Scheme.
Do you need them all? Depends what Lisp you're implementing, if it's something custom, it's all up to you.

Name: Anonymous 2012-06-24 13:43

>>28
For all I know, because it has stricter semantics, and thus it is easier to optimize.

Name: Anonymous 2012-06-25 12:07

茶㑃Ɩ堤嚅㢂⎗榗ᠩ茕饦奴抇䈡腈㖅禖ֈ蠶✒ጹᝩݰ奐呣睙睶吉嚀途∸ሠ鑑㔥顣腗⁹∕᜗掄呷刣蕠删Ĩ刨瘵⤔ٙ荰掂蔇芆㤘碁㑱鑓▅㑀斃⡥㄁犃餀煶Ÿ㈈憓☣ࡔ院則鄨ᤐᅂအ䒅䤄␑7鉕⡷硢․㥦ᤣࠥ゘ű桂┧ᑂᄦ慥ࠓ电䅧聉♢ঁ╈妄莀蔙Ԑ⑕钄㈤桔刨攳匳鐈色畱Ҙ〘昀䅈㥧嚆㎃瀀ᕐ捂ɸ蔑∣薖顀ㄇ夵ल邐ᅆ餁朤㌵ও挩ʓ閁蔑楈坢✙㠳̇⒉䕐㚆猄琄ဢ㔢ኈ᠘艥䍇蘡坕蠠塐ፉΩ碃㦂䔷坤葴薁啠劔ᔁ❗焗偡墂䐩嘓儧ރ䎃䕖቗䑇禗掀䌀ʈⅵᖓ頇ݤ捙Ŧ㔸瑃酲焈兲逇瞅虧撐♁〃䝲靧禙摆ࡤ䑃搓冒馉ࠥ搁ႈ㔡⦇鈢傘Ă荢䄐舖ᕩ㡂瀄锶禙䐦顶茧㑸契碖䄢琂؄蜶遂™鈶⎄襄䀰蕲片蠧ተ⠓焈攣瀧Ē灧砣敀搆ɰœ࢒眔襱鉔傘鄦蒇Ȩ袅㉡ㄢᢙ薓Ħ䤗ᑢ㑘斂ጤ劘ሂ䁔䂉䂕ইᡕɅ牷〷̵ᦀ啓呢⥦喁猷䞔

Name: Anonymous 2012-06-25 12:21

興鑦萇ᡸ㔔⅖焥䍂琇䀤堓圢ْ♄昉䝶⡩ᚕ㑘ْ慴垔㤙萒鑀㘷逧҂兵㘄镡⊁ॄ戁̐ᕧ倵投ݕ㑱閘襁Ш鍱ㅵ⎖ᐨ၁朑㍑᥷瀅镆✡ၥ桕‴΁卩ゕᙳ厃慕ℇ砧㡉⥰疇≇␒啁䆔酇ᅧ楉琁䥣ࠣ➄戓䀥桶䆈酢ॡ堣㎁㡘蚙镲匇獷ቶ喃祙Ř扵皘蘀ሗ䙂爅榁䦁艴ғ儶ᘧ䌴ᝦ錗傒畩䂙ࠥং摨香݈抂頹㌹ᤘ⍕㐔㄃睩愈堗ᙶ逩֔⅒Ȥ㐸爡塑┒⌇࠲ȴ䘘 ݗ性ᒙ杆晣➑褷␶蜣㥧蘢᥶䔴☔፩餧ूݤ䠀其㆒晔✘猢ᆃ匤䚉鄕ё࠲㔘ᆔ⤢ѩ☕䈃霗芒⚆䉥栘倵ܴ扂傉ⅶ瑈蝥䖇蠇Ĩग球技䑁䀇❃⅑ْ၂∈坁搴碆鈙鑙儥皐䢙蠉襘䄅䜣灑❹䥳分关⌡頩䁡းķ鈩畩堓⚂♐蝙⑆ऱ顀圗遉榃圡搖ᤉ劈ᤘޗ㉰᠔外皒爄Ѕ夀醂锦㝳ᝅ葄焘鞔☦鉕䥠ቈ䖆㆖⡳堨禕䌴ᠰܠ搗煶╴ᆁ䅨в萵጖⌷㖀鈘Ɓ疄祓䆆őֆ肇戁Ȇ琂偉栵ᔱ畄瀙䁢冗琓阖

Name: Anonymous 2012-06-25 12:34

嘓傕獑㝐疁䐐ɴ╨䡓青⑂聀㉢楰र⁤奥䡘鈑戦晆興道煂ᅲ陦愙㕓荴嚈ܔ撔嘗酲焇ܢ❦6㈷㘹照鐓㐥ᑃ挱ᑄ↙愳茷ᙠ怅牕嘠卑ᐧ禈畧莗锗ᔙ搕р̃⠵聃֔ ђ挀抃荔ᙑेဩ桸ⅅ䀵摳劂鈶䘕ᢇ襹㙁産閙襹❈㕑艄敩᎖愵㕃ፆ䄧በ⠵㘤战‶㉦⤈暒ᅶ蘣⡷鈰朤萧ᘰၡ霔ж荔选楹䈙ㄇ堆ԧը०刢䁢∓瑥Ł獨蝹⊈∶⌂卉匵午蕰啷爑p猅醐ᐱᑣ䑁Ι蠔࢘舵瘑蜘ᢆ㒆䎖莕ㄧ妗圐摤℩䖗虆鄀ᦉ⥅ֈ䌅㐄䎆椅䍰犗昆Նᑨ焢琡ሱ鉔ا酷ȣ榈垑ᢔ㥂刀ݧ㜥奣銐蘀来街䠄螆鍔ᤤ͒΀䡲扤ᡱ堔䎑䕵蝃恒ㅢ蝹Ѕ聈ᤃ堡覒捩㠅㍕㖈㘣㤴䑇瘑砩㤣ㅡ䥧鐃▖ᚕ镄㤉Т蝘夔␑ᜄ䖈䈂栧芄耖⠸炆⌁䜆衄ቀ搢逡蒁䐐耆㎗眅摷⡸堶噐蝕⡵鎓⠄儖ᚈ恇搘顙碘桨锠⌃इΙظ捶預䠄蒘㞉禃獣嘐咅ᢕ薒癴♹㊙‹圳ᔢ㌘脅璐蕒炘䐀怕ŷ

Name: Anonymous 2012-06-25 12:48

㑙⥄蚓襥ᕥ聢䝠ওᠹ蘡鄴捷㔰蕥䥐 ᕷ鈙儐䍁阢憖坕镠⑧暀ㅳޕ蚔硠碗頁ⅷ奒䄣⢂衖䄗⤵〗愶Сㄔ酰掕坥⢆硆䢃畧偵᜹唠熁摳摹醆ᄙ⁨愥餸鑒ܦ恇虦儴㐄♥瞆ᥨ钒ᡈဣ鉀䁰гᐧ⠠䢆蝇塴鍲䀔䝠杂႕撖梐ᅳᑂ‘ㅂᘙ妕晔ݰ䝃萩⥤ᠣ膂䙑㠐址ᘇ夑攱䔥㘁镘ጱ煢瑦䍂由ጁ楰襠ѡ⍰䔳煣☢慨㒉栉ጐ㝲ㅃ啘蜗㦓蔖呔炖ᙕ⎙戢硶䌢瑣啄蠤甈戣вբ捅⡠‸㈕㤒朱䍴㕡捓艴䁅䍠卵億塂嘒塴剐ႃɁ嘲ᅓ圃㙓刲蕣е礶钇΀善椡鈨䕀(腀硘䠷֗…䉷蔸獲䐴昒虨鄅芒⍧挈舙倸蕧し襐䥇扨嘶⅃ጸ散蠢ण其甸玗祴ܗ蚇灣蔑ࡐ阇Ѥ朆撇犅醆膈瘰奓畔獔脁⁴砷啇瑲鐶猡鉶嘡蘙奴䁱蕤⢔ࡲ䠇ᦁ鍤⥁ٲ㤐0閂礧㌧ͷ࢑䎔墒ᤥ㑗畣⁷ᕓ鐘晶奰ࢆ刨畤坤ع灁鈔䙓㉄研ᄷ偉鎕靱昆焈㕱䠖⊀㠸䜨䙢鑗獡⌨敂奁㡇㕕牳ܨ灡٠

Name: bampu pantsu 2012-06-26 2:57

bampu pantsu

Don't change these.
Name: Email:
Entire Thread Thread List