Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Cybernetic Vermin
Apr 18, 2005

Sagacity posted:

what's a good book on modern compiler design? i.e. a book that has heard about SSA at least and written by someone whose beard has seen a razor in the last five years

i realize those things might be mutually exclusive

i do suspect that the best thing to do in 2021 is to read documentation (and maybe even browse some code) around llvm, and then separately do a side of parsing if you want some more complete coverage.

Adbot
ADBOT LOVES YOU

Eldred
Feb 19, 2004
Weight gain is impossible.

Sagacity posted:

what's a good book on modern compiler design? i.e. a book that has heard about SSA at least and written by someone whose beard has seen a razor in the last five years

i realize those things might be mutually exclusive

Try "Engineering a Compiler"? Not sure what level of detail you want, seems like that text is more of a primer than anything.

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

rjmccall posted:

my beard is going crazy right now, my old razor broke and i haven't been bothered to go to the convenience store

anyway i don't have a good answer for you

allow me to recommend the mühle r41. it’s the best razor ive ever used.

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.

Eldred posted:

Try "Engineering a Compiler"? Not sure what level of detail you want, seems like that text is more of a primer than anything.
Sounds like a good read, thanks! A primer is indeed fine. I kind of handwavingly know about a lot of the concepts but having all concepts explained in a consistent way will make for some entertaining COVID reading.

On behalf of rjmccall thanks everyone for razor tips too

havelock
Jan 20, 2004

IGNORE ME
Soiled Meat

Sagacity posted:

Sounds like a good read, thanks! A primer is indeed fine. I kind of handwavingly know about a lot of the concepts but having all concepts explained in a consistent way will make for some entertaining COVID reading.

On behalf of rjmccall thanks everyone for razor tips too

FWIW I used Modern Compiler Implementation in Java by Appel at least 20 yrs ago and it has a whole chapter on SSA. I have no idea if it's still relevant, but I feel like I learned a lot of fundamentals from it at the time. It looks like later versions of the course I had use the same book but in ML, also published in '98 so similarly dated I assume.

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.
Ah yes, did you feel that it was easier to follow because instead of pseudo code it actually implemented stuff in Java?

Xarn
Jun 26, 2015

raminasi posted:

tbh f# put me on the path to my personal testing heresy because the code i've been happiest with has been decomposed to the point that most functions are simple enough that unit testing them doesn't really make sense

Coworker wrote something like that in the description of a MR I was reviewing.

Luckily he is my good friend, so I could just push some failing tests to the branch, assign it back to him, and then share laugh later. :v:


What I am saying is, always write some tests

raminasi
Jan 25, 2005

a last drink with no ice

Xarn posted:

Coworker wrote something like that in the description of a MR I was reviewing.

Luckily he is my good friend, so I could just push some failing tests to the branch, assign it back to him, and then share laugh later. :v:


What I am saying is, always write some tests

it's hard to respond to this without knowing details, but my initial thoughts are:
- were his functions as small and simple as the ones i'm talking about?
- were your tests unit tests?
- was the value in the tests themselves, or the second pair of eyes?

ime "always write some tests" is too broad of a prescription and ends up being a great way to spend time assembling a large corpus of unit tests that substantially increase maintenance burden but do very little to aid with correctness

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

is Muchnick looked down upon as a compiler text? I bought it in an eager self-improvement mood the last time I worked on a compiler, and have in the intervening decade+ read about 30 pages

Bloody
Mar 3, 2013

I simply never write tests

animist
Aug 28, 2018
isn't llvm basically just the thing all the compiler people were saying we should make 20 years sgo

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

animist posted:

isn't llvm basically just the thing all the compiler people were saying we should make 20 years sgo

you mean asm.js i think

havelock
Jan 20, 2004

IGNORE ME
Soiled Meat

Sagacity posted:

Ah yes, did you feel that it was easier to follow because instead of pseudo code it actually implemented stuff in Java?

It was a compiler class so writing one was the point. They are fun to build and then you can step through to really see what's going on. If you aren't trying to learn a new programming language at the same time just pick the version that better matches what you know. Both OO and functional languages have some nice abstractions for different parts of the implementation so I don't think it really matters which way you go.

feedmegin
Jul 30, 2008

Subjunctive posted:

is Muchnick looked down upon as a compiler text? I bought it in an eager self-improvement mood the last time I worked on a compiler, and have in the intervening decade+ read about 30 pages

I dont know if it's a good introductory text, it's got 'Advanced' in the title for a reason and I remember it being fairly light on, like, Parsing 101 stuff as compared to optimisation. It does cover SSA, though.

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.
The reason I asked is precisely because I know how to write a parser and babby's first compiler, but I was specifically interested in a general overview of slightly more modern techniques. Assuming techniques from the late 90s are still considered modern for compilers, but I guess they are

Cybernetic Vermin
Apr 18, 2005

tbqh i think the problem area is a bit too sprawling to be usefully treated as a single thing whenever you want to step beyond babbys first.

it was historically all put together because compilation was expensive enough that you needed to actually integrate things very carefully (basically designing each step away from single-pass compilation with extreme care). but as things stand parsing, type theory, optimization, designing a runtime, etc. are all fairly complex matters and well treated with careful strict abstractions between them.

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.
well i don't want to build the next llvm, i just want to get a step beyond babby :smug:

Sapozhnik
Jan 2, 2005

Nap Ghost
SSA is early-2000s afaik and that's a big turning point in compiler design, at least the actual code-generating bits.

Parsers haven't changed much in the last few decades though.

Soricidus
Oct 21, 2010
freedom-hating statist shill

Sapozhnik posted:

SSA is early-2000s afaik and that's a big turning point in compiler design, at least the actual code-generating bits.

Parsers haven't changed much in the last few decades though.
ssa is definitely older than that, although I’m sure it took a while to catch on. it’s at least as old as say parser combinators tho.

meanwhile python just switched their parser to use peg, which does I think date from the early 2000s. a few decades ago people were using lex and yacc, now I barely even see lalr talked about. I’m far from an expert, but as someone who does a lot of parsing I’d say things have changed more than a little.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Soricidus posted:

ssa is definitely older than that, although I’m sure it took a while to catch on.

I recall the team working on a Java JIT compiler in the late 90s talking about SSA, which was my introduction to it. I don't know how widely adopted it was in practical compiler circles at that point

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.
speaking of yacc, the reason I asked is not for any useful purpose, I'm just in the middle of a big yacc shave that started with writing a tilemap scroller for the commodore 64, getting annoyed with the tooling, writing my own macro assembler using rust+nom (which is a parser combinator library) and now thinking of maybe writing a simple medium/high-level lang (not a plang or course) on top of that

best case I can brag about the experience during some kind of tech interview

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003

Sagacity posted:

yacc shave

mods

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

Soricidus posted:

ssa is definitely older than that, although I’m sure it took a while to catch on. it’s at least as old as say parser combinators tho.

yeah, turns out Lisp compilers were using a design a lot like SSA in the late 1980s

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
ssa is an old tech. the basic concept is very good, but i've been arguing for years that a literal translation of ssa is a flawed representation: specifically, having phi "instructions" as magic inputs to a block is a bad way of expressing data flow across basic blocks, and it's better to use a more functional representation, like a sort of restricted cps, where basic blocks have parameters that are satisfied by arguments provided to the terminators in predecessor blocks. the representation already needs this concept to deal with function parameters, and this also works far better with higher-level terminators that want to introduce values into one of their successors, like e.g. a dynamic cast that yields the casted value when it succeeds. you can also just structurally say that data flow merges are only allowed on certain terminators instead of spending a poo poo-ton of effort worrying about what happens if you do a data-flow merge across e.g. a switch. we used block arguments this way in swift's higher level ir, sil, and it's been hugely better

llvm ir is also really bad in a number of other ways that have nothing to do with ssa. like the way it deals with local stack allocations is just awful and makes it much harder to generate reasonable stack-use patterns, as well as creating a lot of artificial problems for transformations and higher-level representations embedded in ir. just early mistakes that are almost impossible to fix

really the main thing you need to know about ssa is that it's not the end of ir design. there are a lot of decisions that go into making a good ir that supports the analyses and transformations you want to do in your language. good representations often benefit from a lot of high-level structural rules beyond the simple dominance conditions of ssa, like requiring that a certain operation be ended before a certain other operation

Xarn
Jun 26, 2015

raminasi posted:

it's hard to respond to this without knowing details, but my initial thoughts are:
- were his functions as small and simple as the ones i'm talking about?
- were your tests unit tests?
- was the value in the tests themselves, or the second pair of eyes?

ime "always write some tests" is too broad of a prescription and ends up being a great way to spend time assembling a large corpus of unit tests that substantially increase maintenance burden but do very little to aid with correctness

dunno, I ain't a mind reader. But most of the functions were single line and combined calls to other functions


But my take is, if you are developing something there is about 99% chance that you have some set of functionality requirements, which boil down to "if I do X, I get Y". Whether that maps to unit tests (what do you even define as unit tests? are you of the school of thought that everything but a single class has to be mocked? Or do you prefer to assemble units as close to the production code as possible? I honestly don't care.) or to higher level tests doesn't matter, but you should place those into your test suite.

Or make a fool of yourself later, I've done that enough times :v:

raminasi
Jan 25, 2005

a last drink with no ice

Xarn posted:

dunno, I ain't a mind reader. But most of the functions were single line and combined calls to other functions


But my take is, if you are developing something there is about 99% chance that you have some set of functionality requirements, which boil down to "if I do X, I get Y". Whether that maps to unit tests (what do you even define as unit tests? are you of the school of thought that everything but a single class has to be mocked? Or do you prefer to assemble units as close to the production code as possible? I honestly don't care.) or to higher level tests doesn't matter, but you should place those into your test suite.

Or make a fool of yourself later, I've done that enough times :v:

oh i’m fully on board with having a test suite. i just don’t think that what’s commonly described as a “unit test” should be nearly as large a part of it as is generally accepted.

Bloody
Mar 3, 2013

i hate hate hate the phrase unit test. it is so purposely ambiguous and a source of infinite bikeshedding

champagne posting
Apr 5, 2006

YOU ARE A BRAIN
IN A BUNKER


Bloody posted:

i hate hate hate the phrase unit test. it is so purposely ambiguous and a source of infinite bikeshedding

i hate hate hate the way Vue.js handles tests. "Oh no tests in .vue files are hard to do, just stick to only integration test websites and leave the functions in the vue files as black boxes", which would be fine but my coworkers insist on sticking business logic in them.

Sapozhnik
Jan 2, 2005

Nap Ghost

Boiled Water posted:

i hate hate hate the way Vue.js handles tests. "Oh no tests in .vue files are hard to do, just stick to only integration test websites and leave the functions in the vue files as black boxes", which would be fine but my coworkers insist on sticking business logic in them.

yeah it's almost as if MVC is a fundamentally broken abstraction or something

Sweeper
Nov 29, 2007
The Joe Buck of Posting
Dinosaur Gum

Sapozhnik posted:

yeah it's almost as if MVC is a fundamentally broken abstraction or something

what’s the new hotness

abraham linksys
Sep 6, 2010

:darksouls:

Boiled Water posted:

i hate hate hate the way Vue.js handles tests. "Oh no tests in .vue files are hard to do, just stick to only integration test websites and leave the functions in the vue files as black boxes", which would be fine but my coworkers insist on sticking business logic in them.

vue-testing-library, like all the -testing-library libs, is pretty good for this case

i also tend to err on not writing unit tests for components but i also find writing cypress tests pretty pleasant so i don't mind too much. do yall do integration tests with a mock backend or a live one? both are useful but if you haven't tried a mock backend you might want to look into it for easy testing of component states that might be hard to get into with a real backend

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Sagacity posted:

yacc shave


please

champagne posting
Apr 5, 2006

YOU ARE A BRAIN
IN A BUNKER


abraham linksys posted:

vue-testing-library, like all the -testing-library libs, is pretty good for this case

i also tend to err on not writing unit tests for components but i also find writing cypress tests pretty pleasant so i don't mind too much. do yall do integration tests with a mock backend or a live one? both are useful but if you haven't tried a mock backend you might want to look into it for easy testing of component states that might be hard to get into with a real backend

we have five mocks in this horribly overengineered piece of poo poo

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Sweeper posted:

what’s the new hotness

whatever you're doing now, just pick a different acronym

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Xarn posted:

Or make a fool of yourself later, I've done that enough times :v:

you can go a long way with this

Sweeper
Nov 29, 2007
The Joe Buck of Posting
Dinosaur Gum

Subjunctive posted:

you can go a long way with this

its best if you leave before acquiring the dunce cap

havelock
Jan 20, 2004

IGNORE ME
Soiled Meat

Sweeper posted:

what’s the new hotness

Basecamp just reinvented server side rendering. Maybe it's time to check that out.

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



pro tip: just write the backend and have some other guys write the frontend so you dont have to bother with javascript poo poo

redleader
Aug 18, 2005

Engage according to operational parameters

Carthag Tuek posted:

pro tip: just write the backend and have some other guys write the frontend so you dont have to bother with javascript poo poo

this is the pro move

Adbot
ADBOT LOVES YOU

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003

Carthag Tuek posted:

pro tip: just write the backend and have some other guys write the frontend so you dont have to bother with javascript poo poo

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply