2
$\begingroup$

Suppose you want to introduce a format for a language, commands, ... etc. (Specially in the filed of computer science) in a paper

for example something like below:

X | Y = [ Z ] <W> [ / ] $P

By this, I mean, X or Y could be at the left side of an equation, Z is an optional argument at the right side, <W> is another syntax for something and it is followed by an optional slash and $P is another argument...

What is the standard way to introduce such formalism?

For another example suppose you are

  • The first one who want to introduce XML synatx
  • Someone who want to introduce a syntax near or derived from XML

However I am the case two.

$\endgroup$

migrated from academia.stackexchange.com Jun 7 '15 at 11:09

This question came from our site for academics and those enrolled in higher education.

  • 1
    $\begingroup$ Are you talking about Syntax Definition Formalism (SDF)? $\endgroup$ – scaaahu Jun 7 '15 at 7:01
  • $\begingroup$ @scaaahu maybe, it is very similar to a grammar but maybe not exactly a grammar, it could be the format of some commands! (a minimalist format to be used in papers) ! for example = in the code in my question is part of syntax $\endgroup$ – Ahmad Jun 7 '15 at 7:11
  • $\begingroup$ Which journal? What does that journal's "guide for authors" say? How have previous papers in that journal done it? What did your editor say? $\endgroup$ – EnergyNumbers Jun 7 '15 at 7:26
  • $\begingroup$ Just asked the CS moderators, this is on-topic there, but it's going to need some work before they'll be able to answer it. Follow up over there. $\endgroup$ – eykanal Jun 7 '15 at 11:09
  • $\begingroup$ You're going to need to work on your writing, because I have no idea what notation you want to define. Edit your question to add examples. $\endgroup$ – Gilles Jun 7 '15 at 11:09
3
$\begingroup$

There is no general standard way. It depends to some extent on what is customary in the community you are addressing, on the size and syntactic complexity of the language you are defining, on the amount of formality required, and on whether the formalism is intended for practical use or only for theoretical work.

Typically, if you are defining a programming language, You are likely to decompose the presentation into a lexical and syntactic part. The lexical part defines elements of your language such as identifiers and literals (numbers, strings, or other), usually by means of regular expressions. The syntactic part defines the various constructs of your language, often with a Context-Free grammar. In the case of programming languages, the most common way of defining a context-free syntax is with the Backus-Naur Form (BNF) which is a metalanguage for syntax definition.

I you a creating a shell command for the Unix system, you will use a presentation that is quite close to your example.

If you are defining an algebraic formalism, you may define a tree syntax, or possibly a string syntax based on a context-free formalism, possibly not caring for syntactic ambiguity issues.

It is up to you to be knowledgeable enough to determine what is appropriate in your specific case. Existing similar literature should help you.

Two questions you want to ask yourself when choosing a notation are:

  1. what is sufficient to convey my intent with enough precision, given the purpose and use of the language?

  2. Will it be clear for my readers, given the kind of experience and knowledge they are supposed to have.

Your specific example of being the first to introduce XML syntax, is difficult to answer because the is not really a first. The XML formalism was derived from predecessors such as HTML and SGML, and probably other mark-up languages. One is seldom first, and it is usually wise to restart from the shoulders of those who came before. This applies both to what we define, and to the definitional tools. However, the intended community of users may change, and choices that may be best for a very general public may not be so good for computer specialists, or for theoretical work, the converse being also true. On the other hand, people prefer things close to what they already know.

If you want to introduce a syntax near or derived from XML, the above applies, and you should probably use the same definitional tools But you should probably make sure that your variations are necessary. In such a case, you may also rely on what people may already know of XML, which is fairly widely known, and insist on the differences, on the ways your language departs from XML.

$\endgroup$
  • $\begingroup$ Thank you! I will look at similar syntax, I want it to present a formalism near to HTML or XML syntax $\endgroup$ – Ahmad Jun 7 '15 at 21:02
  • $\begingroup$ @Ahmad Two questions you want to ask yourself: 1 - what is sufficient to convey my intent with enough precision, 2- Will it be clear for my readers, given the kind of experience and knowledge they are supposed to have. $\endgroup$ – babou Jun 7 '15 at 21:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.