AsYacc – first alpha release

http://www.fidam.net/?buy-online-essay-10page buy online essay 10page Before going further with discussing how to add runtime scripting support to a Flash applications, I’d like to share with you the source code of a porting of Yacc I did a while ago. I did some simple modification to make Yacc able to go generate ActionScript 3.0 source code instead of C. It works quite well and supports a lot standard Yacc features. There might be some issues – report them to me and I’ll try to fix them 🙂

You can easilly find documentation about Yacc searching Google (you can start here for example).

Usually Yacc is used in conjunction with a http://www.ctdesign.it/?dissertation-writing-for-payment-3-days dissertation writing for payment 3 days Scanner generator (like Lex/Flex), but I didn’t to any porting of commonly used Scanner generators yet.

Here you can download the sources. The http://www.aroundlife.net/dissertation-funding-public-health/ source code should be portable and compilable on all the most common platform, but I didn’t tested it on Windows yet. To compile the source code on Mac or Linux, cd to the source code directory and type use:

gcc *.c -o AsYacc

follow Once you have the compiled binary file, you can run the Parser generator using:

enter ./AsYacc -Hpackage=it.sephiroth.test grammar.y

Where grammar.y is a text file that contains the grammar of a language defined using the proper syntax (see the docs online for all the detailed information you may need).

dedicate dissertation memory Here you can download a simple calculator example that uses the RegexLexer described previously to implement the Scanner. For the ones who might be interested, here is the grammar used:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* Infix notation calculator. */
%{
%}
%token NUM
%left '-' '+'
%left '*' '/'
%left NEG
%right '^' /* exponentiation */
%%
input:
exp         { trace( $1 ); }
;
exp:
NUM         { $$ = $1; }
| exp '+' exp     { $$ = $1 + $3; }
| exp '-' exp     { $$ = $1 - $3; }
| exp '*' exp     { $$ = $1 * $3; }
| exp '/' exp     { $$ = $1 / $3; }
| '-' exp %prec NEG  { $$ = -$2; }
| exp '^' exp     { $$ = Math.pow( $1, $3 ); }
| '(' exp ')'     { $$ = $2; }
;
%%
  • Hi Gabriele,
    thanks four your code, I can use it very well.
    But I have one problem: If I add more than 31 rules to the class ExprLexer it does not work anymore. It seems that there is a restriction to 32 patterns. The pattern becomes too large which is built in RegexLexer::buildRegExp().
    Do you have any idea?

    distributed leadership literature review Best Regards
    Max

  • Gabriele Farina

    follow Hi Max,
    sorry but I didn’t see your comment before.
    I’ve never had this kind of issue, but probably you can avoid the problem by grouping some rules togheter (ie: keywords or symbols), and then generate different tokens using custom rules.
    Could you please explain me more in depth your situation ? Maybe I can help you more

  • first release? quite great.