Skip to content

ptytb/dream-maker-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

###Dream Maker programming language parser Byond is the game engine using Dream Maker as native programming language. Dream Maker language guide. The goal of this project is complete standalone preprocessor and parser for DM language, written in ANTLR4 and Java.

###Requirements

###Building Run

make

###Running Parse file:

java -Xmx2G -cp .:antlr-4.2.1-complete.jar Main [-t -d -p] -I"path/to/code" 
"main.dme"

Preprocess all and catenate to a single file:

java -Xmx2G -cp .:antlr-4.2.1-complete.jar Main -I"path/to/code" -p 
"world.dme" > amalgamation.dm

####Options

  • -t show GUI parse tree;
  • -d do not preprocess;
  • -p preprocess only;
  • -Ipath include search path.

###Handle parser's events Extend DMParserBaseListener class or implement DMParserListener interface. Then add listener to Main.java:

parser.addParseListener(new MyParserListener());

###Development status Currently parses everything from Baystation 12, tested on commit 57703df2f9f514e72fb46896d0b49262c0e63005. Some dm files with quirks and stray charachters must be fixed.

Despite this grammar is SLL, parsing code tree as a single amalgamation or world.dme file with includes, consumes a lot of memory or slows down cause of garbage collection. But it's very fast if you have enough RAM: 5 min 11 sec, 580M used for whole Baystation 12. Maybe some rework should be done here. ANTLR4 techreport describes what are DFA and ATN structures who consumes your RAM.

Preprocessor currently implements directives:

  • #include.

###TODO

  • implement all remaining preprocessor directives;
  • add parser mode for strings.

###Other implementations and related projects

About

Byond's Dream Maker programming language parser

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published