A
A
Akmal Kadirov2015-01-22 00:51:17
linux
Akmal Kadirov, 2015-01-22 00:51:17

Bison - how to implement OOP?

Let's say you want to create your own programming language. Not to give the world one more of the millions of languages, but for myself. So let's say for self-development. With a tool like Bison it's not that hard. I just don’t understand how to implement classes / objects ...
I would be glad for any information

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey, 2015-01-22
@kadirov

All that Bison will do for you is to simplify the parsing of the grammar, to form a syntax tree. Only.
Roughly speaking, OOP is still the same good old procedural programming. That is, you have a data structure and methods for that structure. That is, an object method is just a function for which you can set a context. You can organize virtual tables for inheritance and a bunch of other things. This is for you, depending on the language you have to think and on its behavior.

U
uvelichitel, 2015-01-22
@uvelichitel

In the first incarnations of C++, an object was stored in a struct structure, inheritance was a reference to a template structure, and methods were references to functions in the structure's fields. Later, virtual tables appeared allowing complex manipulations both at the compilation stage and at runtime.

D
dponyatov, 2016-09-04
@dponyatov

I advise you to start with this book, to understand how dynamic languages ​​work inside.
And then move towards dynamic or static compilation, or transformational programming.
cs.brown.edu/courses/cs173/2012/book/book.pdf
Shriram Krishnamurthi
Programming Languages: Application and Interpretation

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question