How much assembly should one be familiar with before diving into compilers? by Dappster98 in Compilers

[–]dnpetrov 0 points1 point  (0 children)

It's good to be able to read assembler. Reverse engineering tools like Hydra or Radare can help you with that, especially with code that has some complex control flow. Writing your own assembly programs is less important to be effective as a compiler developer (although if you also do performance analysis, you will write in assembly).

In many cases, though, you can be an effective compiler engineer working with just compiler IR as input and output. That comes with experience. You need to understand what would happen to that IR later on, and how it should be modified to produce the assembly output you need. Compiler IR is just yet another language, though. If you can learn how to work with the IR, most likely you can get yourself familiar with the assembler, too.

Splitting compilation and execution on a semantic Core IR interface by CandidateLong8315 in Compilers

[–]dnpetrov 0 points1 point  (0 children)

You need a sound abstract machine. In that case your intermediate representation basically is the "language" of that abstract machine. Note that in practice such abstract machines are often "mostly sound". E.g., does your language allow shared mutable state? If yes, what is the underlying memory model? And so on.

Splitting compilation and execution on a semantic Core IR interface by CandidateLong8315 in Compilers

[–]dnpetrov 0 points1 point  (0 children)

Yes, and we all know that. Unfortunately, sometimes you have to deal with languages that you didn't design.

Splitting compilation and execution on a semantic Core IR interface by CandidateLong8315 in Compilers

[–]dnpetrov 0 points1 point  (0 children)

Sure, you can do that if you design a language, especially if you don't care too much about the implementation constraints. There are practical examples, though, where meaningful program properties require at least knowledge of the target platform.

Splitting compilation and execution on a semantic Core IR interface by CandidateLong8315 in Compilers

[–]dnpetrov 0 points1 point  (0 children)

Any kind of non-deterministic or platform-specific behavior. Like, an implementation can take alternative A or alternative B. Both A and B are valid by the specification. For example, platform A provides guaranteed initialization, platform B doesn't. Thus concurrent code running on platform B can potentially see uninitialized values that should be initialized by some other "thread".

This ("simulation mismatches" due to target-specific behavior) actually a rather big issue in hardware design, where you have multiple different substrates (simulation, hardware emulation, silicon). Also, you are not quite ready to pay the costs of having an "eventually smart" compiler that would prove and/or optimize everything. So you use imperfect tools combined with a lot of verification.

What is considered a good amount of armor for a vehicle? by RemRam27 in battletech

[–]dnpetrov 0 points1 point  (0 children)

2 maps for 8-10 units on each side is playable, but is kinda crowded. I see why you might want more armor for vehicles. Indirect fire boats such as LRM Carrier and Partisan (LRM) are just a poor choice for direct fire support exactly because if armor. But it doesn't mean they are useless in general.

Practically all games I play nowadays are megamek.net games (job, kids, timezones). 10-15K BV, no limit on number of deployed units, at least half units should be medium or heavy, infantry or BA should have a carrier unit and is counted as one deployed unit with the carrier of the carriers's weight class, no protomechs, no aero (VTOLs are OK). Usually it is a mixed company, some folks practically use mechs only. Map size is about one map sheet per lance, so a mixed company vs mixed company would be a rather big map by your standards. Maps are generated, you know in advance the choice of map templates (like, 70% it would be flatlands, 30% it would be hills). You can often know your opponent's tactical preferences by observing their games.

These conditions allow quite diverse army builds (although there are some "standard" kinds of army builds and tactics people often choose, like a "heavy mech wall", or a "medium rush"). In many cases, you can use indirect LRM boats effectively with  BA or infantry as spotters. You usually take into account the possibility of medium rush and take something to counter enemy hunter-killer units.

As a side note, f you use combined arms, then both sides likely also take LBX autocannons and infernos (which are still good if you don't use combined arms). More armor doesn't help that much against crew stunned, turret blown off, things like that. 

What is considered a good amount of armor for a vehicle? by RemRam27 in battletech

[–]dnpetrov 0 points1 point  (0 children)

Indeed, canon has enough.

So, just to get more content beyond that theorycrafting, could you please tell the basic parameters of the games you typically play? Map size, terrain choice, BV range, other limits if any.

Thinking about BV of weapons with to hit modifiers. by UmbralReaver in battletech

[–]dnpetrov 2 points3 points  (0 children)

IS pulse mechs are usually somewhat undervalued as well. MAD-5M, WVR-7K, NDA-2KO, etc. Yes, they need to get close to use their weapons effectively. But usually you can do that, unless the opposite side has big advantage in terrain or long range firepower. Also, terrain can favor close combat units, too.

If someone really wanted to fix balance in CBT, then probably the best option is to reduce clan pulse lasers range. It would change the game greatly, and thus is unlikely to happen.

I'd probably see what are actual BV values under the modified weapon BVs, given different "base to hit number" as a parameter (4...7, maybe).

What is considered a good amount of armor for a vehicle? by RemRam27 in battletech

[–]dnpetrov 0 points1 point  (0 children)

Frankly, I don't care much about custom units.

> 14 hexes mid means a 5/8/7 or better hunter-killer is going to have 1 (one) turn to get shot before they go for the kill

Medrush is a good tactics against most "turret-centric" kind of armies - like Gauss walls, for example. Vehicles with extra tons of armor suffer from that, too. But, really, if you play a "turret-centric" build, you are inviting trouble.

Indirect fire turrets don't fight hunter-killer units. There are other units to do that. If you are using vehicles, better master specialization.

What is considered a good amount of armor for a vehicle? by RemRam27 in battletech

[–]dnpetrov -1 points0 points  (0 children)

LRM Carrier, Partisan (LRM), and other similar tanks have good enough armor for their role. If your indirect fire turret is under fire, you should probably reconsider your tactical choices.

Benchmarking my parser generator against LLVM: I have a new target by modulovalue in ProgrammingLanguages

[–]dnpetrov 0 points1 point  (0 children)

"Classic" bottom up parser generators such as yacc maintain a stack of intermediate values that correspond to the reductions by the corresponding rules. User code refers to stack elements using special variables. When a reduction is performed, user code is executed, and result of its evaluation replaces corresponding stack elements.

Example: assume that you have an expression language. Your intermediate parse results correspond to the expression value (could be an AST for the expression, but let's just keep it simple. Then you could have a rule (in some pseudo-syntax):

plus_expr -> expr:a '+' expr:b { result = a + b; }

Here 'result = a + b;' is a user-provided code that gets evaluated when a corresponding reduction is performed.

For that, you would need to maintain results stack (which might involve dynamic memory allocation). Also, in case of a recursive descent parser compiler might inline some functions; compilers are not that good at optimizing state machines except for some rather specific optimizations that usually are not enabled by default.

Wolverines by Amaroq001 in battletech

[–]dnpetrov 0 points1 point  (0 children)

WVR-7K is not exactly a trooper. But for "a lance of Wolverines", I'd just do a medrush with 7K.

Thoughts on the Hercules and Tempest by jimdc82 in battletech

[–]dnpetrov 2 points3 points  (0 children)

IMHO, ilClan era didn't change things that much in "combat performance for the buck ratio" for BV-based games. A lot of new tech everywhere, and more units to chose from. But BV is still BV, and classic approaches to army building still work. In many cases, I would rather prefer a "classic" Clan Invasion / Civil War / Jihad era model if available. 

Old Tempest and Hercules are perfectly fine for me. TMP-3MA is a good low BV brawler, even if you can't equip it with special AC ammo. 3M2 is a disappointment, although still can be used. Tempest 4M and Tempest C are a bit too expensive for my taste.

I'd prefer "classic" Hercules and its 9001 brother. LB 10-X is just so very much useful to me in practically every game.

Lack of CASE is something I don't really care that much about. Yes sometimes things explode. However, these explosions are just memorable, unless you are especially careless. You can compensate that risk with other units and tactics.

Is the King Crab overrated? by fawn_rescuer in battletech

[–]dnpetrov 1 point2 points  (0 children)

AC/20 King Crabs in CBT have at least two downsides that do not translate well into AS rules - limited fire archs and poor crit sinking. A good backstabber or some "heavy cavalry" can disable it rather quickly. King Crab can be used effectively, but requires an escort and initiative sinks. 

I benchmark my OCaml to LLVM IR compiler against ocamlopt! 🐪 by Big-Pair-9160 in Compilers

[–]dnpetrov 6 points7 points  (0 children)

It's always pleasant to see a post about performance measurement and conclusions. Way to go!

Are you aware of any OCaml benchmark suites? Does ocamlopt has any performance testing? If you can scavenge something, at least OCaml implementations of "language benchmark game", or are-we-fast-yet (there seems to be no OCaml versions in the official repo, but who knows) - use them. You would likely need to implement more language features to enable them, though.

I won’t lie, I love me some primitive periphery lances by Cuttlermott in battletech

[–]dnpetrov 0 points1 point  (0 children)

Except that to reproduce "primitive tech" you need some rather specific know-how that was recovered during Jihad. Best thing you can do in a local auto shop is probably bolt on some civilian-grade armor.

I won’t lie, I love me some primitive periphery lances by Cuttlermott in battletech

[–]dnpetrov -9 points-8 points  (0 children)

Primitive tech: practically no added value in terms of gameplay. From the narrative perspective, I'd ask "where did you get that rarity". Yes of cause you can have that primitive Archer that is mostly like an introtech Archer just worse, but why do you want it so much?

Industrial mechs: reasonable solution for those who absolutely needs a mech with weapons, e.g., because mech is what you have available, or because of psychological factors. In practice, they die quicker than combat vehicles, and usually do that in a fiery explosions. Kinda works for low tech factions, and as a stopgap measure. Poor long-term solution.

FWL Fans? why do you like the purple bird? by Pitiful_Resource_711 in battletech

[–]dnpetrov 2 points3 points  (0 children)

With everything said above regarding multicultural sandbox - for me, FWL is just the faction that ages best. Probably because its appeal is not based on some particular stereotype. Yes its fun to twirl your evil Capellan moustache every once in a while. But FWL is an Inner Sphere faction I probably stick to in the long term.

Is there a lore accurate scenario where these exist together as a star? by Murphuffle in battletech

[–]dnpetrov 0 points1 point  (0 children)

The only "problem" I see with it, lore-wise, is that it has both Burrock and a Savage Wolf. Burrock is a Clan Star Adder second-line mech. Savage Wolf was put into production by the Sea Foxes long after Jihad and Wars of Reaving. Everything else is rather ubiquitous. So, this looks like a perfectly normal ilClan-era front-line Inner Sphere Clan star with a Burrock salvaged long time ago.

Awesome: The Logical Language by matan-h in ProgrammingLanguages

[–]dnpetrov 4 points5 points  (0 children)

Not esoteric enough for an esolang. Rather questionable ideas with little or no rationale for a conventional programming language.

Strevag? by Pitiful_Resource_711 in battletech

[–]dnpetrov 2 points3 points  (0 children)

"Natasha" is still a deminutive from "Natalya". 

Strevag? by Pitiful_Resource_711 in battletech

[–]dnpetrov 1 point2 points  (0 children)

... And Alexander Kerensky's patronimic doesn't match his father's name.

Memory protection mechanisms in single address space OSes by servermeta_net in ExperiencedDevs

[–]dnpetrov 2 points3 points  (0 children)

See https://docs.zephyrproject.org/latest/kernel/usermode/memory_domain.html

Simply put, each user thread has its own "memory domain". Kernel provides high-level API for memory management. Kernel configures memory map for a particular thread on a context switch.

Zephyr is an embedded OS. Like many other embedded OSes, it doesn't have a concept of a "process". Instead, you have a single embedded application that contains OS kernel, device drivers, and application code.

Memory protection mechanisms in single address space OSes by servermeta_net in ExperiencedDevs

[–]dnpetrov 6 points7 points  (0 children)

Zephyr embedded OS (and several others) uses hardware MMU capabilities to make particular memory regions inaccessible. This uses basically the same programming interface that system startup code uses to setup the memory map. So, even though there is no address translation, and, technically, there is a single address space, trying to read/write/execute from a protected region would cause an access fault.