mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
[project] Generate syscalls from new interface DSL
This change adds a new interface DSL for specifying objects (with methods) and interfaces (that expose objects, and optionally have their own methods). Significant changes: - Add the new scripts/definitions Python module to parse the DSL - Add the new definitions directory containing DSL definition files - Use cog to generate syscall-related code in kernel and libj6 - Unify ordering of pointer + length pairs in interfaces
This commit is contained in:
42
assets/grammars/definitions.g
Normal file
42
assets/grammars/definitions.g
Normal file
@@ -0,0 +1,42 @@
|
||||
start: import_statement* (object|interface)+
|
||||
|
||||
import_statement: "import" PATH
|
||||
|
||||
object: description? "object" name options? super? "{" uid method* "}"
|
||||
|
||||
interface: description? "interface" name options? "{" uid interface_param* "}"
|
||||
|
||||
?interface_param: expose | function
|
||||
|
||||
expose: "expose" type
|
||||
|
||||
uid: "uid" UID
|
||||
|
||||
super: ":" name
|
||||
|
||||
function: description? "function" name options? ("{" param* "}")?
|
||||
|
||||
method: description? "method" name options? ("{" param* "}")?
|
||||
|
||||
param: "param" name type options? description?
|
||||
|
||||
?type: PRIMITIVE | object_name
|
||||
|
||||
object_name: "object" name
|
||||
|
||||
id: NUMBER
|
||||
name: IDENTIFIER
|
||||
options: "[" IDENTIFIER+ "]"
|
||||
description: COMMENT+
|
||||
|
||||
PRIMITIVE: INT_TYPE | "size" | "string" | "buffer" | "address"
|
||||
INT_TYPE: /u?int(8|16|32|64)?/
|
||||
NUMBER: /(0x)?[0-9a-fA-F]+/
|
||||
UID: /[0-9a-fA-F]{16}/
|
||||
COMMENT: /#.*/
|
||||
PATH: /"[^"]*"/
|
||||
|
||||
%import common.LETTER
|
||||
%import common.CNAME -> IDENTIFIER
|
||||
%import common.WS
|
||||
%ignore WS
|
||||
Reference in New Issue
Block a user