Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6190535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:36:24+00:00 2026-05-24T02:36:24+00:00

I have lexer/parser (Generated from an ANTLR grammar file) which (for performance reasons) I

  • 0

I have lexer/parser (Generated from an ANTLR grammar file) which (for performance reasons) I have compiled to C code which will be included into my actionscript project using Adobe Alchemly.

The parser will generate an abstract syntax tree (In C) from an input string (passed from Actionscript) – I wish to return the C AST back into actionscript for further processing. How can I convert the tree structure of the AST to a format which I can return to actionscript?

Thanks,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T02:36:25+00:00Added an answer on May 24, 2026 at 2:36 am

    Unfortunately you can’t just send a C data structure across. You’ve got three options, in increasing order of madness:

    1. Serialize the data on the C side and reconstitute it on the AS3 side.
    2. Pack up the data into Objects and return those.
    3. Pass a pointer and size back to AS3 and pull out the data from Alchemy’s ram ByteArray.

    I only include #3 for completeness– I think it would be crazy to try it for any kind of complex data structure. The code would be fragile. Following pointers would be clunky. Bleah.

    For #2 you could use dynamic Objects (via AS3_Object) or concrete ones (via AS3_Get, AS3_New). This is fairly complex code also and not so fast. Can be hard to maintain.

    For #1, the type of serialization is what matters. You could have your C code render the structures to a binary ‘file’, return that, and have your AS3 parse the file format via ByteArray. Or you could render it to XML and have AS3’s XML class parse it. This has the benefit of being fairly fast (since XML is implemented natively), at least on the de-serialization end. If you have a fast XML renderer on the C side (or, ahem, sprintfs), its not so bad.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a lexer built that streams out tokens from in input but I'm
Hi I have a small problem in my ANTLR tree grammar. I am using
I have a program that creates a C# class from a text file. The
I have defined different states in my lexer, which change not depending on the
Hopefully this is a really quick one ;) I have written a lexer /
Have you guys had any experiences (positive or negative) by placing your source code/solution
Have just started using Visual Studio Professional's built-in unit testing features, which as I
i have problem with @members rule in ANTLR. I want overwrite default error handling,
I'm looking for a VM with the following features: Small compiled code footprint (
I have the following token definition in my lexer defining a CharacterString (e.g. 'abcd'):

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.