Skip to content

Macro language: special characters. #682

@kareltucek

Description

@kareltucek

We still support both # and // comment styles, and as far as I remember I promised to discuss and rectify this ambiguity in time, so here we go.

At the moment, the grammar (documentation) does not explicitly allow comments at the end of line, but the parser accepts them. I believe that allowing such comments is strongly desirable.

Yet, # comments at the end of line are not possible after tapKeySeq commands, because # is a legal argument to tapKeySeq. E.g., tapKeySeq a b c # d e f # oops, is this a comment, or a continuation of argument list?

As far as I know this is the only serious problem concerning special characters. Nevertheless, special characters still prevent separating tokeinzation from grammar parsing, which has the following consequences:

  • In order to read a token properly, grammar context has to be known.
  • Implementing proper syntax highlight in Agent's monaco editor is most likely impossible.
  • Using conventional parsing tools to parse the grammar is either impossible or complicated.
  • It complicates any idea of compilation of the language into bytecode. (It does not prevent it, but compilation would have to be done using full parsing machinery, instead of let's say a simple pass that would not care about grammar context.)

I.e., we need to decide what to do about the # character. If we at the same time figure out how to eliminate all special characters it will make certain optimizations easier, but it is not strictly needed.

@mondalaci what is your opinion on what to do with it? (It is you who insisted on # comments over //, so I do expect you to have some opinion on this.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions