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

Pages: 1-4041-

compiler design question

Name: Anonymous 2012-09-28 21:13

In my compiler, I have an emitter function that outputs assembly, affecting the stack, and a variable resolution function that manages local variables and their offset from ebp.

I'm trying to track types through intermediate computations, though, and i don't know whether to put this functionality in the emitter, in the scope resolution system, or to merge the two.

A touhou for your thoughts?

Name: dragon book 2012-09-28 21:14

dragon book

Name: Anonymous 2012-09-28 21:19

>>2
http://en.wikipedia.org/wiki/Dragon_book
Principles of Compiler Design (1977, the "Green Dragon Book"), by Alfred V. Aho and Jeffrey D. Ullman
Are you sure Alfred V. Aho and Jeffrey D. Ullman have no Jewish genetics? Ullman especially looks like a fucking kike.

Name: Anonymous 2012-09-28 21:20

>>3
What if he's a kike? Most kikes are smart and I'm not some paranoid retard who thinks a bunch of smart people with stupid beliefs are controlling my media and putting fluoride in my water.

Back to /b/, ``please''.

Name: Anonymous 2012-09-28 21:24

>>4
Shalom, Hymie!

Name: Anonymous 2012-09-28 21:27

After some considerating, i have decided that i want a typed stack, so the emitter function would be best suited to manage the type system.

However, this introduces the problem of divorcing variable names from their types, and the possibility of the language changing semantics simply by using an alternative backend code generator.

Name: Anonymous 2012-09-28 21:29

>>5
If I were a kike, I wouldn't call Jewish people kikes, would I? The JIDF is not that stupid.

Name: Anonymous 2012-09-28 21:30

>>7
Only Jews and idiots defend the Jews. Are you a Jew or an idiot?

Name: Anonymous 2012-09-28 21:32

>>8
He seems to be an idiot, because he agrees that kikes "are smart", but refuses to kill them, despite it well known that smart=dangerous and all goyim compete with kikes, having mutually exclusive goals.

Name: Anonymous 2012-09-28 21:35

>>4
Big media is a huge steaming pile of shit.

Name: Anonymous 2012-09-28 21:39

In fact, by moving types into the emitter, variable names could follow, and scope resolution could proceed by simply traversing the stack until a stack frame was reached.

Although linear in performance, for a small number of local variables it will not impede compile times compared to the overhead of a hashtable.

This requires the construction of an inner- and outer- emitter to separate the architecture-depending code generation from an imaginary stack-independent virtual bytecode system.

I shall provisionally title this combined emitter/resolution architecture the Joined Inner Declaration Framework

Name: Anonymous 2012-09-28 22:33

I feel sorry for OP, because I'd like to contribute to this thread but I don't know shit about compilers and the Ahmed Goldberg Alliance is shitting up /anus/ as usual

Name: Anonymous 2012-09-28 22:38

>>4
Kikes do control the media you dumb shabbos-goy/kike.

Name: Anonymous 2012-09-28 22:53

>>13
No. They don'.

Name: Anonymous 2012-09-29 0:08

>>1

If you start a new thread and promise you wont let >>3,4,7,8,9,10,13 post in it, I'll help you.

Name: >>15 2012-09-29 0:09

I forgot to list >>14

Name: Anonymous 2012-09-29 0:56

After a misguided attempt to implement >>11 i have come full circle in my deliberations. Why re-implement variable resolution within the emitter? What a shocking deseparation of concerns.

Certainly the correct place to manage the stack, is the place where it has always been managed.

I shall close this hg branch and concentrate on the ability to correctly record temporary computations within the existing infrastructure.

Name: Anonymous 2012-09-29 3:49

>>15
YHBT

Name: Cudder !MhMRSATORI!fR8duoqGZdD/iE5 2012-09-29 4:18

Compiler for what language? That has a big influence on what you should do.
I'm trying to track types through intermediate computations, though, and i don't know whether to put this functionality in the emitter, in the scope resolution system, or to merge the two.
Without knowing the language, I would say in the evaluation tree, which should be after variable resolution but before code generation.

offset from ebp.
This isn't 16-bit x86. Use ESP and free up another register for use. It is astounding how many compilers don't default to doing this, out of tradition or something. There is no disadvantage, only advantage.

Name: Anonymous 2012-09-29 7:50

>>19

has it right.

Name: Anonymous 2012-09-29 14:26

>>14
Yes they do. They even admit they do. It's time to stop being a hypocrite.

http://blogs.timesofisrael.com/jews-do-control-the-media/
http://www.youtube.com/watch?v=L-P-q5zDTu8

Name: Anonymous 2012-09-29 14:53

>>21
Of all accusation, I find the "media control" one the most ridiculous. If you don't like TV, no one forces you to watch it. You ain't in Soviet Union, where the only available newspaper was Pravda. Stop being retarded.

Name: Anonymous 2012-09-29 15:19

>>22
When people are talking about "the media", they obviously mean the mass, mainstream media. Even the most kookiest of kooks don't think Jews have some superpower to control what xXxNaruto97xXx uploads to his video page.
Also, >>21-san forgot:
http://www.latimes.com/news/opinion/commentary/la-oe-stein19-2008dec19,0,4676183.column

It's not like the Jews are denying it. They're proud of it, in very much the same way neo-Nazi skinheads are proud of their race and accomplishments. The difference is, the neo-Nazi skinheads are terrible racists who deserve to be locked up, whereas the Jews are the heroic masterminds behind the movies you're taught to love.

Name: Anonymous 2012-09-29 15:21

>>22
>Of all accusation, I find the "media control" one the most ridiculous.
Why do you find a fact ridiculous? How are people supposed to make an informed choice on not to watch TV if people like you keep lying about who controls the media?

We may not be in the Soviet Union--no, we're in something far worse.

http://www.ivorydome.us/2011/03/can-political-correctness-be-worse-than-leninism/

Name: Anonymous 2012-09-29 15:29

>>23
neo-Nazi skinheads
Why do you equate being proud of one's heritage with Neo-Nazi skinheads? Perhaps you've watched one too many Jewish movies about the holocaust. I'm not a skinhead. I'm not a neo-Nazi.

Jews are the heroic masterminds behind the movies you're taught to love.

Can I ask you what is good about egalitarianism, equality, anti-racism, etc? Especially considering Jews themselves run a racist apartheid state in the Middle East, by the name of Israel. Why is it okay for Jews to be racist murderers, but White Europeans are not allowed to even be proud about their heritage?

If you take a step back, you will realize the objective effect of the anti-racist propaganda that Jews push on the media is nothing more than tribal warfare against White Europeans. Never forget that it was Leon Trotsky, the Jewish leader of the Red Army during the Soviet Revolution, who coined the term "racist" specifically to attack and undermine White Europeans.

Name: Anonymous 2012-09-29 15:31

>>25
>Why do you equate being proud of one's heritage with Neo-Nazi skinheads? Perhaps you've watched one too many Jewish movies about the holocaust. I'm not a skinhead. I'm not a neo-Nazi.
He associates skinhead with being proud with their race, not being proud of your race with being a skinhead. How can you be so ignorant about simple logic. No wonder why the kikes are eating us alive.

Name: Anonymous 2012-09-29 15:32

>>25                            `
>Europeans
>white


Pretty much only Scandinavia (except Finland), France, Germany, and North Italy. The rest are all non-white.

Name: Anonymous 2012-09-29 15:41

>>27
You know what I meant. Western Europeans. Non-Jewish Europeans. If you look at a PCA map of the haplogroup genotypes of native Europeans, they're all pretty close compared to non-European haplogroups.

Name: Anonymous 2012-09-29 15:42

>>26
It was pretty obvious a bijection. Go troll somewhere else.

Name: Anonymous 2012-09-29 15:42

>>28
Jews are more European genetically than slavs.

Name: Anonymous 2012-09-29 15:53

>>30
Sorry, but Slavs and Germans are Indo-Europeans, while Jews are Semites: http://en.wikipedia.org/wiki/File:IndoEuropeanTree.svg

So no, kike, your place is right beside Arabs and niggers.

Name: Anonymous 2012-09-29 15:59

>>30
Jews aren't a race. It's more of a religious/political/cultural identity. They're multiracial.

Most Jews alive today are Ashkenazi Jews, who aren't exactly full-blooded Semites, but rather originate from North-West Asia from the old Khazar Empire. As they bordered Eastern Europe and Asia, there of course has been cross-gene transfer from both regions. There are also minute traces of Semetic heritage from when the Khazars converted to Judaism and allowed exiled Semitic Jews into their homeland, who were quickly subsumed.

There are also Ethiopian Jews (they're Black), full-blooded Semitic Jews who managed to survive in the Levant nations, and Shepardi Jews from Spain/Basque.

Slavs aren't wholly Slav, that's Soviet propaganda. Kind of like how in China everyone is "Han Chinese" now when in reality there are multiple racial groups.

Slavs have a strong inheritance from the Rus, a Scandivian tribe who migrated East and ran a trade empire in Eastern Europe all the way down to Byzantium. The Byzantine empire even hired them to be their elite guard for a time.

http://en.wikipedia.org/wiki/Rus_%28name%29

Name: Anonymous 2012-09-29 16:03

>>31
That's a fucking language tree, Boris.

Name: Anonymous 2012-09-29 16:04

>>31
That's a lie perpetuated by Jews. Most Jews today aren't Semites. They are Khazars, and some of them have a tiny amount of Semitic admixture.

Name: Anonymous 2012-09-29 16:08

``The Implementation of Functional Programming Languages'' (1987) by the Smokin Peyote Joints taught me how to write robust compilers for typed languages.

Name: Anonymous 2012-09-29 16:10

Name: Anonymous 2012-09-29 16:11

>>32
Shalom! That is a lot of pseudoscience even for a Jew.
1. Khazarian hypothesis is a forgery, invented by the Jews themselves, so they can pretend to European citizenship.
2. Russians are composed mostly of Slavs, Finno-Ugric tribes and Tatars/Asians. In Moscow and Ukraine there is a very high influx of Jewish blood.
3. Scandivians had little to do with Slavs, besides giving their name imposing tribute, and only in the Ukrainian part of Russia.

Name: Anonymous 2012-09-29 16:21

>>36
NY Times, a Jewish publication
Some blog by a Jew
Not an objective source of information.

Here's some real science from peer-reviewed and accredited journals in molecular biology.

http://www.pnas.org/content/early/2010/08/23/1004381107.abstract
http://genomebiology.com/content/pdf/gb-2012-13-1-r2.pdf

Name: Anonymous 2012-09-29 16:22

>>36
And just to be clear, the papers linked in >>38 show that Ashkenazi Jews are not, for the most part, Semites. They have trace amounts of Semitic admixture, but that's it.

Name: Anonymous 2012-09-29 16:27

>>37
Why don't you take a look at what the molecular biology community is doing with their GWAS studies, and you shall see that much of what I said about the Rus and Ashkenazim/Khazars are true.

Name: Anonymous 2012-09-29 16:31

>>40
Research is always biased. Scientist is like criminal investigator - his job is to find evidence of guilt.

I can't see either of these papers being in the next IPCC report. Kevin and I will keep them out somehow — even if we have to redefine what the peer-review literature is! -- McKitrick and Michaels (2004)

Name: Anonymous 2012-09-29 16:34

>>41
I lol'd. Epic. Hilarious. I liked it.

Name: Anonymous 2012-09-29 16:39

>>36
No one debates about whether the Khazar conversion to Judaism occurred, only the nature of it.

http://en.wikipedia.org/wiki/Khazars#Debate_about_Khazar_conversion_to_Judaism

You can't trust NY Times or other Jewish rags, that stuff is meant as propaganda to numb the minds of Gentiles.

Name: Anonymous 2012-09-29 16:50

>>1
ebp
x86 is shit.

Name: Anonymous 2012-09-29 22:31

>>19
Thanks. It's a context-free pascal/javascript-esque design with compiled closures and no non-anonymous functions.

It's mostly stack based, i haven't done a register allocator yet. I can see that ebp is superfluous though it's nice to be compatible with stdcall functions.

I have three passes: combined lex/parse -> ast transforms (lambda lifting, syntax sugar) -> walk ast to emit x86. The emitter function caches the last few instructions to reduce redundancy (push followed by pop -> mov, jmp followed by label, etc).

Name: Cudder !MhMRSATORI!fR8duoqGZdD/iE5 2012-09-30 1:56

I can see that ebp is superfluous though it's nice to be compatible with stdcall functions.
EBP is callee-save in stdcall so all you need to do to be compatible is push it when entering and pop it when exiting (if it's used in the function, of course.)

Generating from the AST directly is probably simplest but can't generate as efficient output as creating a flow graph and doing some analyses first, although if you're using the x86 as a stack machine I doubt that was your goal anyway.

(Stack-based code can be insanely dense, as this 256-byte demo that relies a lot on x87 shows: http://www.pouet.scene.org/prod.php?which=3397 )

Name: WOULD HAVE RESPONDED EARLIER 2012-10-06 6:28

IF I WASN'T BANNED

THE USUAL WAY FOR DEALING WITH TYPES IS TO KEEP IT AT THE SYNTAX TREE LEVEL. FOR INSTANCE, THE TYPE OF THE LITERAL ``3'', IS INTEGER. THE TYPE OF THE LITERAL ``7'', IS ALSO INTEGER. THE PLUS NODE, ``+'' HAS TYPE INTEGER WHEN ITS ARGUMENTS ARE INTEGERS. OR IT HAS TYPE FLOAT WHEN ITS ARGUMENTS ARE FLOATS. IT DEPENDS ON THE LANGUAGE HOW EXACTLY YOU WANT TO HANDLE ALL OF THIS, BUT IF YOU WORK ON THE TREE LEVEL, THE INFORMATION THAT YOU WANT SHOULD BE AVAILABLE TO YOU.

THE LEAVES OF THE SYNTAX TREE ARE WHERE YOU START. GET THOSE TYPES FIRST. CONSTANTS HAVE INTRINSIC TYPES, SO THOSE ARE EASY. FOR VARIABLES, YOU SHOULD LOCATE TEH VARIABLE DECLARATION FOR THE CURRENT SCOPE. IF YOU HAVE NESTED SCOPES, YOU MAY HAVE TO REPRESENT THE SCOPE STRUCTURE WITH A STACK OF HASH TABLES OF VARIABLE DEFINITIONS, OR SOMETHING TO THAT EFFECT. JUST DO A LINEAR SEARCH FROM THE INNER MOST SCOPE TO THE OUTER MOST FOR A DEFINITION. ONCE THE VARIABLE HAS BEEN BOUND TO A DEFINITION, YOU ARE SET FOR THE NEXT PHASE.

IF YOUR LANGUAGE REQUIRES ALL VARIABLE DECLARATIONS TO HAVE A TYPE, THEN YOU CAN EXTRACT THE TYPE FOR THE VARIABLE BY GETTING IT FROM THE VARIABLE'S DEFINITION. IF YOU'RE LANGUAGE USES TYPE INFERENCE, THEN IT'S HARDER. YOU WILL HAVE TO LOOK AT ALL INSTANCES IN THE SYNTAX TREE WHERE THE VARIABLE IS REFERENCED, AND SEE HOW IT IS USED. EACH TIME IT IS USED, THERE WILL BE CONSTRAINTS PLACED ON WHAT ITS TYPE MUST BE. THE TYPE OF THE VARIABLE CAN BE CONSTRUCTED BY UNIFYING THESE CONSTRAINTS.

IF YOU ARE CREATING A DYNAMIC LANGUAGE, YOU DON'T REALLY NEED TO CARE TOO MUCH ABOUT ANY OF THIS. ONCE THE RUN TIME SYSTEM IS COMPLETE, YOU DON'T REALLY CARE WHAT TYPES THINGS ARE AT COMPILE TIME.

THE ONLY WAY I COULD SEE A TYPED STACK BEING USEFUL IS IF YOU WERE CREATING A STATICALLY TYPED STACK BASED LANGUAGE. THIS WOULD BE HARD TO DO, BECAUSE IN MOST STACK BASED LANGUAGES, FUNCTIONS CAN CONSUME A PRODUCES DIFFERENT AMOUNTS OF VALUES BASED UPON THEIR INVOCATION. AND THIS IS IMPOSSIBLE TO KEEP TRACK OF SINCE EVEN TRYING TO CONSTRUCT A PARSE TREE WILL REDUCE TO THE HALTING PROBLEM. IT'S STILL AN INTERESTING THOUGHT THOUGH. IF EVER OPERATOR CONSUMES AND PRODUCES A KNOWN CONSTANT AMOUNT OF VALUES, THEN THE STACK BASED REPRESENTATION IS ACTUALLY EQUIVALENT TO A SYNTAX TREE. BUT THE SYNTAX TREE WILL PROBABLY GIVE YOU BETTER ACCESS TO THE VALUES YOU NEED. GOOD LUCK AND SORRY FOR NOT RESPONDING EARLIER, BUT I WAS BANNED FOR A WEEK. SINCERELY, >>15-SAN. I HAD A LOT TO SAY BECAUSE I HAD A WEEK TO THINK ABOUT IT.

Name: 48 2012-10-06 15:17

AND ONCE THE TYPE INFORMATION IS ENTERED INTO THE SYNTAX TREE, YOU CAN THEN CREATE TEMPORARY NAMES FOR ALL SUBEXPRESSIONS. THEN EMIT THE CODE FOR THE EVALUATION OF THE TEMPORARY VALUES IN A POST ORDER TREE WALK. THIS WAY, YOU CAN LEVEL OUT THE TREE TO GET A REPRESENTATION MORE SUITABLE FOR AN ASSEMBLY LANGUAGE.

A = (X + (Y * 34)) + 45

WILL BECOME

A = ([T1]: X + ([T2]: Y * 34)) + 45

T2 = Y * 34
T1 = X + T2
A = T1 + 45

AND THIS COMBINED WITH TYPE INFORMATION ABOUT THE INTERMEDIATE VALUES IS ENOUGH INFORMATION TO PRODUCE THE NEEDED ASSEMBLY OUTPUT. AT THIS POINT, ALL THAT REMAINS IS HOW TO ALLOCATE THESE VARIABLES.

Name: >>49 2012-10-06 15:33

>>49

ALSO YOU COULD ELIMINATE COMMON SUB EXPRESSIONS BY KEEPING THE TEMPORARY VALUES INDEXED IN A TABLE BY THEIR EXPRESSION VALUE. IN ORDER TO EMPLOY THIS SUCCESSFULLY, YOU WILL NEED TO BE ABLE TO KEEP TRACK OF EXPRESSIONS THAT HAVE AND DON'T HAVE SIDE EFFECTS. EXPRESSIONS THAT HAVE NO SIDE EFFECTS CAN SAFELY HAVE THEIR RESULTS COMBINED TO A SINGLE VARIABLE AND ONLY BE EVALUATED ONCE, BUT DOING THIS FOR AN EXPRESSION THAT HAS SIDE EFFECTS WILL CHANGE THE MEANING OF THE PROGRAM, AND MUST BE AVOIDED. AN EXPRESSION WILL HAVE SIDE EFFECTS IF AT LEAST ONE OF THE FOLLOWING ARE SATISFIED

THE EXPRESSION IS A PRIMITIVE OPERATOR THAT YIELDS A SIDE EFFECT, LIKE ++.
THE EXPRESSION IS A CALL TO A FUNCTION THAT IS NOT PURE.
THE EXPRESSION CONTAINS A SUBEXPRESSION THAT HAS SIDE EFFECTS.

A FUNCTION IS NOT PURE IF IT SATISFIES AT LEAST ONE OF THE FOLLOWING

IT PERFORMS AN IO OPERATION OR EQUIVALENT
IT MODIFIES A NON LOCAL VARIABLE

NOTE THAT IT IS POSSIBLE FOR A PURE FUNCTION TO CALL A NON PURE FUNCTION IF THE ONLY VARIABLES MODIFIED ARE LOCAL TO THE PURE FUNCTION.

THE PURITY/NONPURITY OF THE FUNCTIONS CAN BE CONSTRUCTED FROM THE BOTTOM UP. LOOPS CREATED WITH RECURSION IS WEIRD THOUGH.

Name: 2012-10-06 15:37

Name: 2012-10-06 15:37

Name: 2012-10-06 15:37

Name: 2012-10-06 15:37

Name: 2012-10-06 15:37

Name: 2012-10-06 15:37

Name: Anonymous 2012-11-10 22:39

>>47-49
I've rediscovered my thread. Upon reading your wisdom, keeping types at the AST level is surely the most sensible place.

I have partially completed it with a typed stack but i'm not sure if it's possible to continue - it depends on being able to resolve all possible control structures. For instance, i think unrestricted goto makes compile-time typechecking via a typed stack impossible. AST typing is certainly the most sensible place, although it would have to occur in an intermediate compiler pass once variables are declared but not yet emitted.

May your bans be short in future,
Regards

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