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 55877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:26:46+00:00 2026-05-10T17:26:46+00:00

I have read the GOLD Homepage ( http://www.devincook.com/goldparser/ ) docs, FAQ and Wikipedia to

  • 0

I have read the GOLD Homepage ( http://www.devincook.com/goldparser/ ) docs, FAQ and Wikipedia to find out what practical application there could possibly be for GOLD. I was thinking along the lines of having a programming language (easily) available to my systems such as ABAP on SAP or X++ on Axapta – but it doesn’t look feasible to me, at least not easily – even if you use GOLD.

The final use of the parsed result produced by GOLD escapes me – what do you do with the result of the parse?

EDIT: A practical example (description) would be great.

  • 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. 2026-05-10T17:26:47+00:00Added an answer on May 10, 2026 at 5:26 pm

    Parsing really consists of two phases. The first is ‘lexing’, which convert the raw strings of character in to something that the program can more readily understand (commonly called tokens).

    Simple example, lex would convert:

    if (a + b > 2) then

    In to:

     IF_TOKEN LEFT_PAREN IDENTIFIER(a) PLUS_SIGN IDENTIFIER(b) GREATER_THAN NUMBER(2) RIGHT_PAREN THEN_TOKEN 

    The parse takes that stream of tokens, and attempts to make yet more sense out of them. In this case, it would try and match up those tokens to an IF_STATEMENT. To the parse, the IF _STATEMENT may well look like this:

     IF ( BOOLEAN_EXPRESSION ) THEN 

    Where the result of the lexing phase is a token stream, the result of the parsing phase is a Parse Tree.

    So, a parser could convert the above in to:

         if_statement         |         v     boolean_expression.operator = GREATER_THAN        |          |        |          v        V       numeric_constant.string='2'      expression.operator = PLUS_SIGN      |     |      |     v      v   identifier.string = 'b'    identifier.string = 'a' 

    Here you see we have an IF_STATEMENT. An IF_STATEMENT has a single argument, which is a BOOLEAN_EXPRESSION. This was explained in some manner to the parser. When the parser is converting the token stream, it ‘knows’ what a IF looks like, and know what a BOOLEAN_EXPRESSION looks like, so it can make the proper assignments when it sees the code.

    For example, if you have just:

    if (a + b) then

    The parser could know that it’s not a boolean expression (because the + is arithmetic, not a boolean operator) and the parse could throw an error at this point.

    Next, we see that a BOOLEAN_EXPRESSION has 3 components, the operator (GREATER_THAN), and two sides, the left side and the right side.

    On the left side, it points to yet another expression, the ‘a + b’, while on the right is points to a NUMERIC_CONSTANT, in this case the string ‘2’. Again, the parser ‘knows’ this is a NUMERIC constant because we told it about strings of numbers. If it wasn’t numbers, it would be an IDENTIFIER (like ‘a’ and ‘b’ are).

    Note, that if we had something like:

    if (a + b > ‘XYZ’) then

    That ‘parses’ just fine (expression on the left, string constant on the right). We don’t know from looking at this whether this is a valid expression or not. We don’t know if ‘a’ or ‘b’ reference Strings or Numbers at this point. So, this is something the parser can’t decided for us, can’t flag as an error, as it simply doesn’t know. That will happen when we evaluate (either execute or try to compile in to code) the IF statement.

    If we did:

    if [a > b ) then

    The parser can readily see that syntax error as a problem, and will throw an error. That string of tokens doesn’t look like anything it knows about.

    So, the point being that when you get a complete parse tree, you have some assurance that at first cut the ‘code looks good’. Now during execution, other errors may well come up.

    To evaluate the parse tree, you just walk the tree. You’ll have some code associated with the major nodes of the parse tree during the compile or evaluation part. Let’s assuming that we have an interpreter.

    public void execute_if_statment(ParseTreeNode node) {     // We already know we have a IF_STATEMENT node     Value value = evaluate_expression(node.getBooleanExpression());     if (value.getBooleanResult() == true) {         // we do the 'then' part of the code     } }  public Value evaluate_expression(ParseTreeNode node) {     Value result = null;     if (node.isConstant()) {         result = evaluate_constant(node);         return result;     }     if (node.isIdentifier()) {         result = lookupIdentifier(node);         return result;     }     Value leftSide = evaluate_expression(node.getLeftSide());     Value rightSide = evaluate_expression(node.getRightSide());     if (node.getOperator() == '+') {         if (!leftSide.isNumber() || !rightSide.isNumber()) {             throw new RuntimeError('Must have numbers for adding');         }         int l = leftSide.getIntValue();         int r = rightSide.getIntValue();         int sum = l + r;         return new Value(sum);     }     if (node.getOperator() == '>') {         if (leftSide.getType() != rightSide.getType()) {             throw new RuntimeError('You can only compare values of the same type');         }         if (leftSide.isNumber()) {             int l = leftSide.getIntValue();             int r = rightSide.getIntValue();             boolean greater = l > r;             return new Value(greater);         } else {             // do string compare instead         }     } } 

    So, you can see that we have a recursive evaluator here. You see how we’re checking the run time types, and performing the basic evaluations.

    What will happen is the execute_if_statement will evaluate it’s main expression. Even tho we wanted only BOOLEAN_EXPRESION in the parse, all expressions are mostly the same for our purposes. So, execute_if_statement calls evaluate_expression.

    In our system, all expressions have an operator and a left and right side. Each side of an expression is ALSO an expression, so you can see how we immediately try and evaluate those as well to get their real value. The one note is that if the expression consists of a CONSTANT, then we simply return the constants value, if it’s an identifier, we look it up as a variable (and that would be a good place to throw a ‘I can’t find the variable ‘a” message), otherwise we’re back to the left side/right side thing.

    I hope you can see how a simple evaluator can work once you have a token stream from a parser. Note how during evaluation, the major elements of the language are in place, otherwise we’d have got a syntax error and never got to this phase. We can simply expect to ‘know’ that when we have a, for example, PLUS operator, we’re going to have 2 expressions, the left and right side. Or when we execute an IF statement, that we already have a boolean expression to evaluate. The parse is what does that heavy lifting for us.

    Getting started with a new language can be a challenge, but you’ll find once you get rolling, the rest become pretty straightforward and it’s almost ‘magic’ that it all works in the end.

    Note, pardon the formatting, but underscores are messing things up — I hope it’s still clear.

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

Sidebar

Ask A Question

Stats

  • Questions 235k
  • Answers 236k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Effectively, the IN statement creates a series of OR statements...… May 13, 2026 at 6:17 am
  • Editorial Team
    Editorial Team added an answer It's more or less hacking right? The following might work… May 13, 2026 at 6:17 am
  • Editorial Team
    Editorial Team added an answer if (count($array) == 1){ echo $array[0] . " has been… May 13, 2026 at 6:17 am

Related Questions

I read about WPF and I have following concerns: Normally when we develop applications
I have two specific C# coding conventions I've been practicing with mixed feelings. I'd
I have read the documentation on this and I think I understand. An AutoResetEvent
I have read the post here about using setTimeout() during intensive DOM processing (using

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.