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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:15:24+00:00 2026-06-11T16:15:24+00:00

I recently made a toy programming language using C, Bison, Flex, and this post

  • 0

I recently made a toy programming language using C, Bison, Flex, and this post as a starting point. It looks a lot like Python except there’s no colons or whitespace rules.

The code is here, but it’s less important than the concept/algorithm I’m stuck on.

I designed my abstract syntax tree just like Rudi did in the post linked above.

The trick is, I can’t think of a great way to return from user-defined functions, or break out of loops. If I require only a single return statement at the end of a user-defined function, it’s doable (actually this is what currently works for user-defined functions).

Example:

i = 0
while 1 do
  if i > 15 then
     break
  end
done

Example 2:

def mean(somelist)
  if len(list) == 0 then
    return 0  # throw error
  else
    return sum(somelist) / len(somelist)
  end
end
  • 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-06-11T16:15:25+00:00Added an answer on June 11, 2026 at 4:15 pm

    Some popular stack-based languages push a value onto the stack which is then popped by the calling function. That might work for you.

    Of course, this relies on having a function with a known return type. Python returns PyNone if the function is ‘void’ (i.e. returns nothing). A Python function returns only one value (which could be None, or an object or a tuple or whatever).

    C-type languages also return only one value from a function.

    I think the point is that in a strong-typed language you always have a return value and you must always return one. In a weak typed language where you might or might return a value, you have one nonetheless.

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

Sidebar

Related Questions

I know that NULL isn't necessary in a programming language, and I recently made
I recently made this simple navigation where you have a couple links that have
I recently made this wordpress blog, where you can sign up a team for
I recently made the change from Dreamweaver to NetBeans and noticed this IDE doesn't
I recently made a Mootols script for my website. Using Fx.Morph, I succesfully created
Ok. I recently made some updates to this website. http://annberingerart.com/index.php Upon making some minor
I recently made a project using opencv and c++ in visual 2008 When i
I recently made a question based on doing a HTTP request with POST data
I have recently made a change to an existing app and we would like
I'm using boost for several C++ projects. I recently made a upgrade (1.33.1 to

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.