data-reviser compiler
easy way to write data-reviser code: write sample code named dr
then compile to javascript or typescript by this tool.
Prerequisites
- only support
Linux
system so far. make
andg++
.
Install
make install
Uninstall
make uninstall
CLI Args
--ts-out={path}
specify typescript code output directory, may be a absolute path or relative path base on pwd
--js-out={path}
same as --ts-output
, but for javascript code.
--printer={fs|terminal}
specify output type, fs
will write code to a file on disk. default terminal
Example
- create
example.dr
then type below:enum Color { Red = 1, Blue, Yellow } struct Foo { required string foo = "foo"; bool baz = true; Color bar = Color.Red; int32 age = 0; }
- execute
reviserc --ts-output=tsoutput example.dr
will output code to the terminal.
Developer
- base on vscode
Remote-Containers
https://code.visualstudio.com/docs/remote/containers - execute
Remote-Containers: Open Folder In Contaier
in vscode then chose this project root dir.
Grammer
see grammer.md
TODO
- support comment.
- compile to javascript.
- compile to typescript.
- support
struct
types. - support
array<struct>
types. - support
enum
,array<T>
types. -
decorator
allow parameters. - check data type.
- support nested statement
- support scope.
- support write to file.
- validate default value such as int64.
- support package & import.
- syntax highligth for editor.
- delete unused ast pointer.
Licence
MIT