I came here from Amanda’s talk about AST which led me to Ale’s
post both very interesting having said that NGL - I have not finished both till the end. Need more learning or refresher on former.
In Ale’s post I am struggling to understand the below two assumptions that I took or understood it that way:
1. Operand = Expression
The above stands true if the LHS is equated to RHS
However RHS is not a constant as is evaluated by
applying principles of BODMAS to LHS.
2. I am struggling to understand the necessity of 2 languages (apologies if it sounds otherwise intended) as I feel Kotlin allows us to do it perhaps?
I am not an expert but my understanding is the parser (say designed for Kotlin language)
a. From the intermediate class identify the patterns or classify regex and do recursive process of elimination
b. If the patterns matches the keyword and operands [stored in appropriate Data Structure] of the language (then removed them / push). - Pass 1
c. Read the file LTR, get the constants away (i.e. remove them / push) - Pass 2
d. Read the file LTR, get the variables (i.e. remove them / push) - Pass 3
Then pop and using S-expression apply BODMAS = Voila ?
If I have missed something or misunderstood please guide me.