PasteRack.org
Paste # 87363
2019-06-14 08:38:58

Fork as a new paste.

Paste viewed 467 times.


Embed:

pasm-parser.rkt

#lang brag

; everything is inside blocks
pasm-program : pasm-block*

; blocks can contain either code, string data, or arbitrary data
@pasm-block : pasm-code-block | pasm-string-block | pasm-data-block
; blocks must have a label
@pasm-block-header : LABEL /NEWLINE*

; code block is the default for empty blocks because the other block types
; require at least one item

; 0 or 1 statements per line
pasm-code-block : pasm-block-header [pasm-statement] (/NEWLINE [pasm-statement])*
pasm-string-block : pasm-block-header STRING-DATA (/NEWLINE [STRING-DATA])*
pasm-data-block : pasm-block-header DATA (/NEWLINE [DATA])*

; opcodes can have any number of arguments
pasm-statement : OPCODE [pasm-arglist]
@pasm-arglist : pasm-arg (/ARG-DELIM pasm-arg)*
@pasm-arg : INTEGER | FLOAT | STRING | pasm-register-ref | pasm-switch

; wrap these argument types because they need special handling
pasm-register-ref : REGISTER-REF
pasm-switch : SWITCH

=>

standard-module-name-resolver: collection not found
  for module path: (submod brag reader)
  collection: "brag"
  in collection directories:
   /home/pasterack/.racket/6.8/collects
   /home/pasterack/racket68/collects
   ... [161 additional linked and package directories]
  context...:
   show-collection-err
   standard-module-name-resolver
   /home/pasterack/racket68/share/pkgs/scribble-lib/scribble/private/manual-code.rkt:112:0: get-tokens
   /home/pasterack/racket68/share/pkgs/scribble-lib/scribble/private/manual-code.rkt:56:0: typeset-code15
   /home/pasterack/pasterack/tmp/87363/87363code.scrbl: [running body]
   loop
   ...cket/cmdline.rkt:179:51
   /home/pasterack/racket68/share/pkgs/scribble-lib/scribble/run.rkt: [running body]