Re: Tree-like construction while parsing the input file

2009-01-11 Thread Ilyes Gouta
value of item_declaration is $1 and item_list is $2 and the overall return value is $$. What would be the value of item_declaration in my action if I put the latter just straight after it (not at the end of the rule)? item_list: | item_declaration { action1(&*$?*); } ite

Tree-like construction while parsing the input file

2009-01-10 Thread Ilyes Gouta
um_listand item_list rules to be able to "see" the allocated container so that I can populate it when the parser hits those rules. I don't like to use global variables (such as handle in this example) since declarations may be nested and thus handle won't point to the correct cont

Re: for loops in C style

2008-02-29 Thread Ilyes Gouta
of my own right now and I'm really feeling like I'm duplicating that functionality so may be I'm going to rewrite the actions to use bison in the standard way (i.e, actions use $$, $1, $2, etc.). But I also believe that it's also a limit

Re: for loops in C style

2008-02-29 Thread Ilyes Gouta
t tree, this includes types propagation (for the float and int conversions), registers allocations and then native opcode emitters. Best regards, Ilyes Gouta. ___ help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Re: for loops in C style

2008-02-29 Thread Ilyes Gouta
OK, got it. One has just to define fexpr as: fexpr: ';' { action1(); } | expr ';'{ action2(); } and to redefine for_stmt as: for_stmt: for (assignment expr assignment) block ; to get the right behavior. :) Thanks again, guys! Best regards, Ilyes Go

Re: for loops in C style

2008-02-29 Thread Ilyes Gouta
oop. Is it the only way do things clearly and properly? Best regards, Ilyes Gouta. On Thu, Feb 28, 2008 at 9:59 PM, Hans Aberg <[EMAIL PROTECTED]> wrote: > On 28 Feb 2008, at 15:16, Ilyes Gouta wrote: > > > I'm writing a small grammar for a very simplified C language. My goal

for loops in C style

2008-02-28 Thread Ilyes Gouta
count such a scenario? Any ideas? Best regards, Ilyes Gouta. ___ help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Pushing and poping the semantic stack

2008-02-15 Thread Ilyes Gouta
st checked if it compiles fine and it was OK, however I didn't check the coherency of the whole recognition process. Best regards, Ilyes Gouta. ___ help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Re: intermediary representation and bison?

2007-12-24 Thread Ilyes Gouta
while. As you said, the rest of the compilation phases such as resource binding and code emission would become just direct products of the AST traversal. Thank you again for your suggestions! Best regards, Ilyes Gouta. Evan Lavelle wrote: I had the same problem on my first language; here's

intermediary representation and bison?

2007-12-23 Thread Ilyes Gouta
ht) to emit bind the identifiers to registers and to emit the native opcodes. But I can also do these actions directly in the semantic rules without trees construction.. Guys, any suggestions? I'm confused. Best regards, Ilyes Gouta. ___ help-bi

Re: About the FOR loop semantic action

2007-10-20 Thread Ilyes Gouta
an action in the middle of a rule, at least to mark the beginning of a block and its end, i.e: block: '{' { begin_marker(); } declarations statements { end_marker(); } '}' ; to save the content of the entire block and re-execute it as long as the condition is valid. Any thoughts? BR, Ilyes Gouta. ___ help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

About the FOR loop semantic action

2007-10-20 Thread Ilyes Gouta
e the second expression/condition is valid? I also have a second questio: Is it possible to instruct bison to skip one part of a semantic rule if a given condition isn't met? It's typically useful for the "if then else" closure, i.e: if_stmt: IF expr { update(&($2)); } block { reset(); } ; where block won't be parsed/executed if the expr isn't valid. BR, Ilyes Gouta. ___ help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Re: Multitype support in bison

2007-10-14 Thread Ilyes Gouta
lized (per type) rules that would emit those specialized native instructions directly w/o checking the type (since we already hit the specialized grammar rule). Am I right? Are these the *only* solutions to solve the issue? Laurence: thank you so much! BR, Ilyes Gouta. On 10/14/07, Laurence Finst

Re: Multitype support in bison

2007-10-14 Thread Ilyes Gouta
R to get its value and let bison push it in the evaluation stack. I think, I can't have two != sets of rules. As Hans Aberg said, I'll have to do type-checking within the actions... Any clues? BR, Ilyes Gouta. On 10/14/07, Laurence Finston <[EMAIL PROTECTED]> wrote: >

Re: Multitype support in bison

2007-10-14 Thread Ilyes Gouta
Thank you, Laurence, for your answer! I'm going to experiment a bit with all this and I'll keep you posted. BR, Ilyes Gouta. On 10/14/07, Laurence Finston <[EMAIL PROTECTED]> wrote: > On Sat, 13 Oct 2007, Claudio Saavedra wrote: > > > > > El sáb, 13-10-2007 a

Re: Multitype support in bison

2007-10-13 Thread Ilyes Gouta
Hi, > Hm, and maybe he is actually doing such a homework? :-) > Well, I'm doing it fun mainly. I'd like to experiment with JIT compiled code. Is it possible to get an answer on my previous comment? :) Thanks in advance! BR, Ilyes Gouta.

Re: Multitype support in bison

2007-10-13 Thread Ilyes Gouta
ersion for my simplified C-like language where the parser emits native opcodes instead of just interpreting the script. Waiting for your answer! BR, Ilyes Gouta. ___ help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Multitype support in bison

2007-10-12 Thread Ilyes Gouta
istinguish between the two types given the identifier's name, stored in id. Any ideas guys? BR, Ilyes Gouta. ___ help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison