From: Michael D. Lowis Date: Mon, 27 Jan 2020 15:25:23 +0000 (-0500) Subject: reorged code slightly X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=ff83816282419a48977d16414dfd38871ac86e7b;p=proto%2Fsclpl-rb.git reorged code slightly --- diff --git a/Ada Notes.html b/Ada Notes.html index c209969..d3001ca 100644 --- a/Ada Notes.html +++ b/Ada Notes.html @@ -2,7 +2,7 @@ Ada Notes - + @@ -84,21 +58,21 @@ int_def := range_spec real_def := 'digits' static_simple_expr { range_spec } -array_def := +array_def := -record_def := +record_def := -access_def := +access_def := -derived_def := +derived_def := -interface_def := +interface_def := # Miscellaneous symbol := <ident> | <char-lit> range_spec := 'range' static_simple_expr '..' static_simple_expr static_expr := -static_simple_expr := +static_simple_expr :=

diff --git a/compile.rb b/compile.rb index 2971519..f128cd0 100755 --- a/compile.rb +++ b/compile.rb @@ -226,15 +226,10 @@ class Parser sym[:kind] = :var sym[:type] = type_specifier() if accept("=") - sym[:value] = const_expr() + sym[:value] = expression() end end - def const_expr() - expect("{") - expect("}") - end - ####################################### # Function Definitions ####################################### @@ -264,6 +259,17 @@ class Parser expect("}") end + ####################################### + # Expression Parsing + ####################################### + def expression() + expect("{") + expect("}") + end + + ####################################### + # Parsing Primitives + ####################################### def error(str) puts str exit 1 diff --git a/example.src b/example.src index de48bf8..ec09af4 100644 --- a/example.src +++ b/example.src @@ -1,20 +1,8 @@ module Main imports (X11, XSel, Posix) -Command is [ 1 String ] -Command2 is [10 [5 String]] -PointRef is **Point -MyStruct is { - foo : Int - bar : [10 Int] -} +cmd : [String] = [ "fetch", nil, nil ] -##Command is { -## name : String -##} -# -#cmd : Command #= [ "fetch", nil, nil ] -# #fetchsel(sel : String) #{ ## cmd[1] = sel; @@ -23,7 +11,7 @@ MyStruct is { # #$main(args : array of String) : Int #{ -## x : X11.Config = {0} +## x : X11.Config = {} ## X11.init(&x) ## X11.mkwin(&x, 1, 1, X11.PropertyChangeMask) ## XSel.init(&x)