Search Results

Search found 2 results on 1 pages for 'applegrew'.

Page 1/1 | 1 

  • Need help regarding one LALR(1) parsing.

    - by AppleGrew
    I am trying to parse a context-free language, called Context Free Art. I have created its parser in Javascript using a YACC-like JS LALR(1) parser generator JSCC. Take the example of following CFA (Context Free Art) code. This code is a valid CFA. startshape A rule A { CIRCLE { s 1} } Notice the A and s in above. s is a command to scale the CIRCLE, but A is just a name of this rule. In the language's grammar I have set s as token SCALE and A comes under token STRING (I have a regular expression to match string and it is at the bottom of of all tokens). This works fine, but in the below case it breaks. startshape s rule s { CIRCLE { s 1} } This too is a perfectly valid code, but since my parser marks s after rule as SCALE token so it errors out saying that it was expecting STRING. Now my question is, if there is any way to re-write the production rules of the parser to account for this? The related production rule is:- rule: RULE STRING '{' buncha_replacements '}' [* rule(%2, 1) *] | RULE STRING RATIONAL '{' buncha_replacements '}' [* rule(%2, 1*%3) *] ; One simple solution I can think of is create a copy of above rule with STRING replaced by SCALE, but this is just one of the many similar rules which would need such fixing. Furthermore there are many other terminals which can get matched to STRING. So that means way too many rules!

    Read the article

  • Cannot read value from SYS_CONTEXT

    - by AppleGrew
    I have a PL/SQL procedure which sets some variable in user session, like the following:- Dbms_Session.Set_Context( NAMESPACE =>'MY_CTX', ATTRIBUTE => 'FLAG_NAME', Value => 'some value'); Just after this (in the same procedure), I try to read the value of this flag, using:- SYS_CONTEXT('MY_CTX', 'FLAG_NAME'); The above returns nothing. How did the DB lose this value? The weirder part is that if I invoke this proc directly from Oracle SQL Developer then it works. It doesn't work when I invoke this proc from my web application from callable statement. --EDIT-- Added an example as to how we are invoking the proc from our Java code. String statement = "Begin package_name.proc_name( flag_val => :1); END;"; OracleCallableStatement st = <some object by some framework> .createCallableStatement(statement); st.setString(1, 'flag value'); st.execute(); st.close();

    Read the article

1