brain-labs / brain

An esoteric programming language compiler on top of LLVM based on Brainfuck
https://brain-labs.github.io/brain/docs/html/index.html
GNU General Public License v3.0
132 stars 18 forks source link

Rename expression files (and classes) #60

Closed luizperes closed 6 years ago

luizperes commented 6 years ago

We need to rename all files and classes because they are being described wrongly. For example:

OutputExpr, should be OutputStmt, however, ArithmeticExpr should probably be kept the same. We need to discuss it.

Any thoughts @haskellcamargo, @ryukinix, @rafaelcn ?

ryukinix commented 6 years ago

Hmm... this is bad, but easy to fix with a good editor. Statement means a instruction, expression however means a instruction and is signed to a value to be returned, is it? I mean.... I'm trying to figure out what is the problem. If is this and you want to change the name to describe all the operations correctly, you should list what are these classes that was described wrongly and fill on this issue.

But how about using a more generic name? Like Operation or something else. That way would be OutputExpr -> OutputOp. But I'm not sure about that.

haskellcamargo commented 6 years ago

We first need to list everything that should be renamed and why. The concepts of Statement and Expression differ from language to language and some languages have only one kind of node. In Quack, now, we have statements, expressions and also declarations. In Brain, actually, if nothing really returns and the things can be remapped to opcodes, I believe we have instructions (statements are, in general, a lot more complex), like Assembly. In Haskell, for example, we only have expressions and declarations (statements don't exist!). For Brain, the fact is: OutputExpr is not an Expr, but an instruction.

ryukinix commented 6 years ago

I agree with Instruction as replacement for the suffixExpression, the only problem is that I did not find a good and short way to write Instruction as I can find forExpression orStatement. I mean ... OutputExp seems clearly what is, butOutputInstr is good? Keeping in the long form OutputInstrunction is to me too long if this matters - but this is only aesthetics, anyway.

luizperes commented 6 years ago

Instr sounds cool to me, such as llvm do

ryukinix commented 6 years ago

If is a common jargon on LLVM, I'm ok with it.