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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:36:57+00:00 2026-05-25T22:36:57+00:00

I’m writing a tool to parse Ada source file with the grammar provided in

  • 0

I’m writing a tool to parse Ada source file with the grammar provided in 2005 Annex P.

  1. With following piece of code, I know [“03C0”] stands for “greek letter Pi”, but is it a legal variable name?

    01 package Ada.Numerics is
    02    Pi : constant := 3.14159_26535_89793_23846_26433_83279_50288_41971_69399_37511;
    03    ["03C0"] : constant := Pi;
    04    e : constant := 2.71828_18284_59045_23536_02874_71352_66249_77572_47093_69996;
    05 end Ada.Numerics;
    
  2. When using the grammar to parse line 03, I currently come to “basic_declaration”. Which is the next rule? And next next rule? Next next next rule? Until [“03C0”] can be successfully parsed. Eventually, the question should be: Which rule parsed [“03C0”]?

The Ada Reference Manual is at:
http://www.adaic.org/resources/add_content/standards/05rm/RM-Final.pdf

Ada Reference Manual Page 702 in PDF, Page 676 at the right down corner of the page . Annex P / 3.1

    3.1
    basic_declaration ::=
        type_declaration | subtype_declaration
        | object_declaration | number_declaration
        | subprogram_declaration | abstract_subprogram_declaration
        | null_procedure_declaration | package_declaration
        | renaming_declaration | exception_declaration
        | generic_declaration | generic_instantiation

I’ve done further investigation based on oenone‘s answer.

  1. If I use [“03C0”] in the code, the character set does not need to be “UTF-8”, which makes sense.
    When compile, I need “gnatmake -gnatWb Hello.adb”.
  2. If I use p in the code, I must change the character set to “UTF-8”, otherwise the GPS will not recognize this character and prompt a message.
    After I change it to UTF-8, I need to use “gnatmake -gnatW8 Hello.adb” to compile.
  3. I tried to change [“03C0”] to [“abcd”] and compile again, it will fail, saying “invalid wide character in identifier”.
    I GUESS: If [“03C0”] is parsed by grammar only, [“abcd”] will also pass the grammar check.
    So from the fail result and message, I can say, GNAT works in this way:
    there is a pre-process before send source file to the grammar parser.
    The pre-process will evaluate the unicode value, check whether or not it is in the valid wide character set.
    If it is inside the valid wide character set, it will continue send to the grammar parser. Otherwise, fail.
  • 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-25T22:36:58+00:00Added an answer on May 25, 2026 at 10:36 pm

    1: see A.5 The Numerics Package – the RM uses the correct unicode character. Your quote seems to be from the GNAT package. For this, see the GNAT Users Guide about how to tell GNAT which encoding it should use.

    2: No rule from the ARM. It is an encoding question, which is done by the implementation (GNAT). ["03C0"] (with -gnatWb, which is default) is handled like π (with -gnatW8) or even Pi as valid identifier for a variable name (or in this case constant).

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

Sidebar

Related Questions

i want to parse a xhtml file and display in UITableView. what is the
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

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.