Skip to content

Commit

Permalink
introduce the 'global' qualifier
Browse files Browse the repository at this point in the history
  • Loading branch information
Mesabloo committed Jan 10, 2021
1 parent 83813d6 commit 857a1ec
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
2 changes: 2 additions & 0 deletions part2-nstar.tex
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,8 @@ \subsection{The \texttt{code} section}\label{subsec:nstar-common-sections-code}
Every assembly instruction makes the current context vary in some way, either by binding registers, forgetting about some bindings, changing register types, or some other way. The current context is just a record keeping track of the currently bound registers, along with the data type they contain.
More on that in sections about instructions\footnote{Instructions are platform-specific, that's why we don't talk about them here.}.

Every label can also be given an optional \texttt{global} qualifier, which is used to indicate that the label can be used outside of the file (it can be thought of as ``exported'').

\subsection{The \texttt{data}, \texttt{rodata} and \texttt{udata} sections}\label{subsec:nstar-common-sections-data}

The \texttt{data} and \texttt{rodata} sections are sections used to reference (read-only) literal data (much like constants in PHP).
Expand Down
23 changes: 22 additions & 1 deletion railroad-diagrams.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,25 @@ def nop_instruction():

return mk_diagram('nop-instruction', inner)

nop_instruction().writeSvg(sys.stdout.write)
def code_line():
inner = Choice(
1,
Sequence(
Optional(
Terminal('global')
),
NonTerminal('identifier'),
Terminal(':'),
NonTerminal('label-type')
),
Sequence(
Optional(
Terminal('unsafe')
),
NonTerminal('code-instruction')
)
)

return mk_diagram('code-line', inner)

code_line().writeSvg(sys.stdout.write)
Binary file modified res/nstar/sections/code-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 857a1ec

Please sign in to comment.