Closed csziklai closed 4 months ago
Awesome! I’ll review this soon. I’d say please don’t worry about wrestling with the parser, move on to the interpreter which I think you’ll find juicier. If I want to play with the parser it won’t be anything significant; I’ll do it myself in a separate PR :)
Sounds good. Just one thing, what is considered a value in this interpreter, i.e., what is the interpreter trying to produce in the end? I'm thinking that it's a policy but it seems like there is something I'm missing since I'm not doing anything with the classes.
Yes, the end result will be a policy! The point of taking the list of classes at the top is that only those classes can then appear in the policy that you create. So for example the following is an illegal program:
classes A, B
return rr(A, B, C)
because the class C is not known to the program.
On the other hand the following is legal:
classes A, B, C, D
return rr(A, B, C)
The point of this program is “drop packets from class D, and give round-robin behavior to packets from the other three classes”.
Heads up, I changed the "base" of this PR from main
to test_env
. So now this PR is correctly showing four commits, not 29!
So then in the first program you have written in your previous comment, policy = A
is saying that the policy is just the class A?
This PR builds on #25. It adds variable assignment, syntactic sugar, and the ability to put comments in our DSL. To run, cd to dsl_lang, then in the command line
To parse sample programs, run
A doubt I have is the definition of a program. As discussed in #27, it could be defined as
or
This version of the parser works on a program being defined as merely a statement. I've been trying to think over whether this is a problem or could it actually just give the interpreter a little more work, but still work fine? If the latter is true, I would rather do more work on the interpreter than wrestle with the parser. So I'm unsure which direction to go from here.